One of the co-plaintiffs, Rupa Marya of the San Francisco-based group Rupa and The April Fishes, also praised the decision as momentous, saying, "I hope we can start reimagining copyright law to do what it's supposed to do -- protect the creations of people who make stuff so that we can continue to make more stuff."
Marya said she had paid Warner/Chappell $455 to include the song on a live album during which members of her band and the audience sang the song to her the night before her birthday.
Warner/Chappell has said it doesn't try to collect royalties from just anyone singing the song but those who use it in a commercial enterprise.
"We are looking at the court's lengthy opinion and considering our options," Warner/Chappell said in a statement following Tuesday's ruling.
King's decision comes in a lawsuit filed two years ago by Good Morning To You Productions Corp., which is working on a documentary film tentatively titled "Happy Birthday." The company challenged the copyright, arguing that the song should be "dedicated to public use and in the public domain."
"Because Summy Co. never acquired the rights to the 'Happy Birthday' lyrics, defendants, as Summy Co.'s purported successors-in-interest, do not own a valid copyright in the Happy Birthday lyrics," King concluded in his 43-page ruling.
The lawsuit also asked for monetary damages and restitution of more than $5 million in licensing fees it said in 2013 that Warner/Chappell had collected from thousands of people and groups who have paid to use the song over the years.
Marshall Lamm, a spokesman for one of the plaintiffs' lawyers, said that issue would be determined later.
In his ruling, King went into great detail about the history of "Happy Birthday To You," and its derivation from "Good Morning to All."
That song was written by sisters Mildred Hill and Patty Hill sometime before 1893, the judge said, adding that the sisters assigned the rights to it and other songs to Clayton F. Summy, who copyrighted and published them in a book titled "Song Stories for the Kindergarten."
"The origins of the lyrics to Happy Birthday ... are less clear," the judge continued, adding the first known reference to them appeared in a 1901 article in the Inland Educator and Indiana School Journal.
The full lyrics themselves, King said, didn't appear in print until 1911.
Since then, they have become the most famous lyrics in the English language, according to Guinness World Records. The song is also sung in countless other languages around the world.
Associated Press Writer Andrew Dalton contributed to this report.