Moscow's Lefortovsky district court ruled that the sailors must stay in detention for an extra three months until October 24.

After the hearings, the sailors were escorted out of the courtroom by masked security officers as relatives and supporters applauded. Some wiped away tears.

Relatives sported yellow bracelets bearing the names of the sailors, who face up to six years in prison on charges of illegally crossing Russian borders.

In the cramped courtroom, the sailors, who have described themselves as "prisoners of war", were held in a metal-barred cage reserved for defendants.

The Ukrainians have been imprisoned since their three vessels were seized off Crimea last November, the most dangerous direct clash between Russia and Ukraine in years.

Russian President Vladimir Putin and Ukraine's new leader Volodymyr Zelensky discussed a possible prisoner swap during their first phone call last week.

In Kiev on Tuesday, Vadym Prystaiko, a senior presidential official, said that Ukraine and Russia agreed to exchange a certain number of prisoners over the next month.

'Keep hoping'

"I am ready to wait for as long as needed as long as this ends well," Natalya Mokryak, mother of the commander of one of the detained vessels, Roman Mokryak, said in court.

"They haven't done anything wrong," added Iryna Guzhanska, whose husband Yury Budzylo is also among the prisoners, said before the hearing began.

"We keep hoping," she told AFP before the hearing began.

Lawyer Nikolai Polozov, who heads the defence team, and Ukraine's rights ombudsman Lyudmyla Denysova, who attended the hearing, said Russia and Ukraine were negotiating a possible prisoner exchange. They declined to discuss any details.

On Tuesday, Denysova and her Russian counterpart Tatyana Moskalkova exchanged lists of prisoners.

Kiev's list consists of "150 cases," Denysova has said.

Among the most prominent Ukrainian prisoners held in Russia is Oleg Sentsov, who is a serving a 20-year sentence in a Russian penal colony north of the Arctic Circle.

Last year, he went on a hunger strike and went 145 days without solid food.

Putin's spokesman Dmitry Peskov said Wednesday that the prisoner swap was "on the agenda."

Speaking ahead of the hearing, Polozov said Russia would likely extend the sailors' detention "as a manoeuvre to exercise control."

'Lack of political will'

He suggested that Moscow may release the sailors at some point after Sunday's parliamentary elections in Ukraine.

"I am hoping that the sailors could be released before the trial starts," Polozov told reporters, saying they were "in good spirits."

"The only thing that separates the sailors from their freedom is a lack of political will of the Russian leadership."

But the defence team also did not rule out that the sailors would have to be tried first before they could be exchanged.

Lawyer Ilya Novikov told AFP that the trial could start in September and last until November.

He did not rule out that it could be held in Russia-annexed Crimea, a move that would complicate access to the hearings for diplomats and journalists.

He suggested that the prisoner-swap negotiations were failing to gain traction.

"No one wants to make the first move," he said.

On Tuesday, US special envoy to Ukraine, Kurt Volker, encouraged Russia to agree to a prisoner exchange with Kiev.

"If successful, it will be the result of direct engagement between Presidents Zelensky and Putin," he tweeted.

In November, Russia opened fire on three Ukrainian navy vessels as they tried to pass through the Kerch Strait from the Black Sea to the Sea of Azov.

The two countries have been locked in a confrontation since 2014 when Moscow annexed Crimea and supported an insurgency in eastern Ukraine.

More than 10,000 people have been killed in the conflict.