A court in northwestern Edirne province released two Greek soldiers pending trial on Tuesday, according to a judicial source.

On March 2, Lt. Aggelos Mitretodis and Sgt. Dimitros Kouklatzis were remanded in custody by a court after they were detained near the Pazarkule district of Edirne. According to the soldiers, they got lost due to bad weather and later came across local Turkish patrol units.

Turkish security sources said the Greek soldiers were accused of espionage and sending recordings on their smartphones to their superiors.

During the trial in Edirne on Tuesday, the two soldiers reiterated their claim that they had crossed the border by mistake and urged the court for their release, the source, who asked not to be named due to restrictions on speaking to the media, said.

The court then ordered the release of the soldiers pending trial, the source added.

"The release of the two Greek soldiers is an act of justice, which will contribute to strengthening friendship, good neighborly ties and stability in the region," he said on his Twitter account.

"I want to congratulate and thank our two officers and their families for their vigor, patience and confidence in the efforts for all of us, which have finally been justified," he added.

Greek Foreign Minister Nikos Kotzias also welcomed the release of the soldiers, stating on his Twitter account that "diplomacy is the big winner of the evening".

"It is a great joy that Angelos and Dimitris are free. I wish they will reach the homeland as well," he said.

Kotzias also congratulated Greek officials in Turkey, including the Ambassador to Turkey, Petros Mavroidis.

"Thanks to those who helped on the Turkish side," he added.

European Commission President Jean-Claude Juncker also welcomed Turkey's decision.

"Delighted by the news of the imminent release of the 2 Greek soldiers detained in Turkey," he said on his Twitter account.

"As I said in Varna,Turkey has nothing to fear from its European neighbours. The EU will remain engaged in this strategic partnership. We want to see a democratic, stable & prosperous Turkey," he added.

In late March, a Turkey-EU summit was held under the leadership of Turkish President Recep Tayyip Erdogan, European Council President Donald Tusk and Juncker in Varna, Bulgaria.

During the summit, matters such as Turkey-EU relations were discussed.