THESSALONIKI, Greece (AP) - Two Turkish soldiers were released from Greek custody after they were arrested Sunday for entering Greece illegally.

Both armies have released statements which differ slightly in the details.

The Turkish army statement, released first, said the soldiers were trailing migrants to keep them from crossing into neighboring Greece, but accidently passed the border themselves.

The Greek army said that the first Turkish soldier, a non-commissioned officer reservist, had been detained at 11:00 a.m. Sunday (0800 GMT) about 1,540 meters (yards) inside Greek territory. He had his rifle with him, but no ammunition.

The second Turkish soldier, a reserve officer trainee, was arrested three hours later, at 2 p.m. (1100 GMT) carrying neither weapons nor ammunition.

The two soldiers gave depositions, with the first claiming that he had lost his way and found himself inside Greek territory and the second saying he had gone to search for his fellow soldier. Both were given medical exams and found in good health, the Greek Army statement said.

A Greek army spokesman earlier had confirmed the arrest to The Associated Press but had not been able to provide details. He denied Greek media reports that gunfire was exchanged during the incident.

The spokesman requested anonymity because the case was under investigation.

The Turkish army said the soldiers were detained at 11:00 a.m. Sunday (08:00 GMT) and released after 7½ hours after talks with Greek authorities. The Greek army confirmed the time of release, adding that the defense ministers of the two countries, Greece's Panos Kammenos and Turkey's Hulusi Akar had been in contact.

Turkey arrested two Greek soldiers in March. Greek officials said they had veered off course while on patrol near the border. They were detained until last month, when they were released to Greece pending trial.

__

Zeynep Bilginsoy in Istanbul and Demetris Nellas in Athens, Greece contributed to this story.

___

Follow Costas Kantouris on Twitter: https://twitter.com/CostasKantouris