"NATO has decided to impose an arms embargo on Libya, which could have concrete results and lead to an eventual recourse to arms. Germany will not take part in this," a Defence Ministry spokesman said late Tuesday.
"The ministry has decided to place two frigates and two ships in the Mediterranean under national command," he added.
The two frigates, Lübeck and Hamburg, are part of NATO's Active Endeavour operation to stem terrorist activities in the region.
The spokesman said: "For the time being, these vessels will remain in the Mediterranean and we have not decided where they will go."
There are about 550 defence personnel aboard the four ships.
NATO agreed Tuesday to use naval and air power to enforce an arms embargo on Libya.
The NATO forces will monitor, report and, if needed, "interdict vessels suspected of carrying illegal arms or mercenaries," said NATO Secretary General Anders Fogh Rasmussen.
"All allies are committed to meet their responsibilities under the United Nations resolution to stop the intolerable violence against Libyan civilians," Rasmussen said.
He said NATO had completed plans to help enforce the no-fly zone "to bring our contribution, if needed, in a clearly defined manner, to the broad international effort to protect the people of Libya from the violence of the Qaddafi regime."
Germany, a non-permanent member of the UN Security Council, abstained in a vote on Thursday to permit "all necessary measures" to establish a no-fly zone, protect civilian areas and impose a ceasefire on Muammar Qaddafi's military.
But Chancellor Angela Merkel's cabinet decided Wednesday that Germany will send up to 300 crew members to operate surveillance planes in Afghanistan in a bid to free up NATO resources enforcing the no-fly zone in Libya.
"The federal government will make available up to 300 army troops for the AWACS surveillance flights over Afghanistan within the framework of NATO's ISAF mission," the defence ministry said in a statement.
Germany is the third-largest provider of troops to the International Security Assistance Force in Afghanistan in a mission that polls show is deeply unpopular at home.
Speaking before the cabinet meeting, Defence Minister Thomas de Maiziere said: "This is a real easing of the burden on NATO. It is a political sign of our solidarity with the alliance, especially given the events in Libya."
NATO agreed to deploy the Airborne Warning and Control System (AWACS) planes, which are fitted with long-range radar allowing them to detect other aircraft and prevent mid-air collisions, to Afghanistan in January.
The cabinet's decision has to be approved in parliament, probably on Friday.