Senior officers told Turkish media they believed the law was unconstitutional
Turkey's president has approved a law giving civilian courts the power to try military personnel threatening national security or linked to organised crime.
The legislation was proposed by the ruling AK party in parliament despite concerns expressed by the military.
It also bars military courts from prosecuting civilians in peacetime.
President Abdullah Gul said the new law was necessary as part of Turkey's move to join the EU, which requires military courts to try only military cases.
"In implementing these reforms, it would be beneficial for legal changes to be made to remove doubts likely to arise over discipline and legal guarantees from the perspective of military service," Mr Gul said in a statement on Wednesday after signing the law.
Deputy Prime Minister Cemil Cicek said the president had recommended the government amend the legislation to include legal assurances concerning the duties of military personnel.
The main secularist opposition Republican People's Party said it would attempt to get the law annulled by the Constitutional Court.
"The president's approval was a wrong decision," the party's deputy chairman, Onur Oymen, told the Anatolia news agency.
There was no immediate reaction from the military, but last week senior officers told Turkish media they believed the law was unconstitutional and might cause clashes between the military and civilian prosecutors.
Turkey's military, which has overthrown four governments since 1960, considers itself the guardian of the country's secular constitution.
Dozens of people, including several retired generals, are currently on trial accused of being part of the shadowy ultra-nationalist Ergenekon network, which prosecutors believe plotted attacks to provoke a military coup.