German forces with the frigate Karlsruhe (back left)
The German navy says it has foiled an attempt by pirates to hijack an Egyptian cargo vessel off Somalia.
Six Somali pirates were captured by sailors of the frigate Karlsruhe in the Gulf of Aden.
However, the pirates were immediately released on the orders of the German government, officials told the BBC.
Separately, three Chinese naval ships were due to leave their home port of Sanya on Thursday to protect Chinese ships off Somalia.
There have been more than 100 pirate attacks this year in the Gulf of Aden and several countries have deployed warships there.
The Karlsruhe sent a helicopter to protect the Egyptian cargo ship Wadi al-Arab from the pirates, who shot and wounded a member of its crew as they tried to board the vessel.
A German navy spokesperson based in Djibouti told the BBC's Greg Morsbach the Somali attackers were disarmed by German sailors and their weapons confiscated.
"We had forces on board the frigate, and they used fast small boats, and together with the helicopter we were able to surround the pirates and disarm them," he said.
He said the decision not to detain or arrest them was taken by the German government in Berlin.
A spokesman for the EU's mission off Somalia, Cdr Achim Winkler, told the BBC's Europe Today programme that Germany would only bring pirates to justice where German interests were hurt.
This would be the case if a German ship was attacked or German citizens were killed or injured, he said.
The injured crewman is being treated on the Karlsruhe.
The UN Security Council recently passed a resolution giving members states extra powers to deal with pirates on the High Seas, including the power of detention and arrest.
The Chinese ships - two destroyers and a supply ship - aim to defend Chinese shipping from pirates, the ministry of defence said.
The BBC's Chris Hogg in Beijing says China has followed a doctrine of non-interference in other nations' affairs and despite this new type of deployment the ministry insists this has not changed.