The German royalty collections body GEMA sued YouTube over 12 specific music videos to which it holds the rights.
The Hamburg court ruled that YouTube was responsible for making sure that any uploaded videos did not breach copyright and ordered it take down seven of the 12 clips concerned.
In the five other cases, the lawsuit was formally withdrawn because there was no evidence that the videos had been uploaded to the site.
Apart from ruling that YouTube was responsible for the actions of its users, the court also said that individuals who uploaded the videos again could face a fine of up to €250,000, or a custodial sentence of up to six months for violating court orders.
YouTube must install filters to prevent users from uploading copyrighted music videos without permission, it said.
YouTube said it took no responsibility for what users did but said it always responded when told of copyright violations.
GEMA represents about 60,000 German song writers and musicians.
The ruling represents the culmination of a legal battle between GEMA and YouTube that has dragged on since 2009, when the last contract between them expired. After no follow-up agreement was reached, GEMA sued YouTube in 2010.