The regional court of Hamburg upheld a lower court ruling and rejected both appeals by Google and German performing rights organization Gema on Wednesday.
According to the ruling, Google owned YouTube do not have to actively search for illegal activities on its platform.
"However, if such a service provider has been made aware of a clear violation of the law, it must not only remove the content, but also must take precautions to avoid further infringements of copyrights," the court said.
A spokesman for Google in Germany said that it would wait until the court's detailed reasoning is published in two weeks' time before deciding whether it will appeal the ruling.
YouTube and Gema are fighting in several legal fronts.
Google won a legal victory over Gema on Tuesday when the court rejected the organization’s request to make Google pay each time users watched videos by its member artists.