(Reuters) - Online music streaming service Grooveshark, admitting "very serious mistakes," shut down its operations as part of a settlement with major record labels, joining the ranks of several now-defunct peers sued over copyright infringement.

In a message posted to its website on Thursday, Grooveshark said that "despite (the) best of intentions, we made very serious mistakes. We failed to secure licenses from rights holders for the vast amount of music on the service."

The settlement ends a four-year legal battle and came as Grooveshark's parent company, Escape Media Group, was facing hundreds of millions of dollars in damages in a trial set to begin in federal court in Manhattan on May 4.

Grooveshark will wipe clean all of the record companies' copyrighted works and hand over ownership of its website, mobile apps and intellectual property, including patents and copyrights, the company said. 

Nine record companies, including Arista Music, Sony Music Entertainment, UMG Recordings, and Warner Bros Records, sued Escape Media Group for infringement in 2011.

In court papers, they called Grooveshark a "linear descendant" of Grokster, LimeWire and Napster, all of which were shut down because of copyright infringement. 

The labels on Friday referred to a statement by the Record Industry Association of America, which called the deal "an important victory for artists and the entire music industry."

The RIAA said that Escape founders Joshua Greenberg and Samuel Tarantino agreed to "significant financial penalties" if the terms of the settlement were breached. A spokesman for Grooveshark declined to comment.

Gainesville, Florida-based Grooveshark was thriving with more than 30 million users. The company said it had a policy to honor copyright holders' "takedown" requests that comply with the Digital Millennium Copyright Act.

(Reporting by Ismail Shakil in Bengaluru and Andrew Chung in New York; Editing by Gopakumar Warrier, Alexia Garamfalvi and Dan Grebler)