In the music industry’s second big legal victory in a week, a federal judge in New York ruled on Monday that Grooveshark, an online music service long vilified by the major record companies, infringed on thousands of their copyrights.

Like Napster, LimeWire, Grokster and other online outlets before it, Grooveshark came under fierce attack from the recording industry for hosting music files without permission. Grooveshark — based in Gainesville, Fla., and identified in court papers by its parent company, Escape Media Group — makes millions of songs available for streaming.

Yet despite numerous legal challenges, the service continued operating and building a huge audience in the years before the arrival of Spotify and other streaming outlets, which operate with the permission of record companies and music publishers. By 2011, Grooveshark — which has licenses for some of its music, but not all — claimed to have 35 million users and was attracting advertising from major brands like Mercedes-Benz and Groupon.

Grooveshark’s defense has long been that it is legal under the Digital Millennium Copyright Act, the federal law that protects websites that host third-party material if they comply with takedown notices from copyright holders.