TEHRAN (Reuters) - Iran has charged three detained U.S. citizens with espionage, the official IRNA news agency quoted a prosecutor as saying on Monday, but Secretary of State Hillary Clinton said there was no evidence to back the charges.

Missing American hiker Sarah Shourd is seen here in this undated photo released by freethehikers.org, August 20, 2009. REUTERS/freethehikers.org/Handout

The three, Shane Bauer, 27, Sarah Shourd, 31, and Josh Fattal, 27, were held after crossing into Iran from northern Iraq at the end of July. Their families said they were hiking and had strayed across the border accidentally.

Iranian President Mahmoud Ahmadinejad said the case was for the judiciary to decide, but also said that some Iranians had spent many years in U.S. jails without doing anything wrong.

“We would like all prisoners to be released,” he told a news conference at an Islamic summit in Istanbul. “Hopefully all these problems will be resolved.”

The case comes at a time of higher tensions between Iran and the West over Tehran’s nuclear plans and after Iranian officials accused foreign nations of fuelling the widespread unrest after a disputed presidential election in June.

“The three are charged with espionage,” Tehran general prosecutor Abbas Jafari Dolatabadi told IRNA. “Investigations continue into the three detained Americans in Iran.”

Both Clinton and the detainees’ families called on Iran to exercise “compassion.”

“We believe strongly that there is no evidence to support any charge whatsoever,” Clinton said in Berlin.

“And we would renew our request on behalf of these three young people and their families that the Iranian government exercise compassion and release them so they can return home, and we will continue to make that case,” she added.

“CONVINCE THE JUDGE”

In a joint statement, the families said: “The allegation that our loved ones may have been engaged in espionage is untrue...

“We again call on Iran to show compassion to our loved ones and release them without delay. This has already gone on for too long.”

Ahmadinejad said the three had crossed the border illegally. “Hopefully they would convince the judge that they didn’t have the intention to cross the border illegally, and we hope that will happen,” he said, speaking through an interpreter.

Under Iran’s Islamic law, espionage is punishable by death. Some Iranian officials linked the illegal entry of the Americans to the turmoil that erupted after Iran’s June poll.

Ahmadinejad referred to the case of an Iranian pilgrim he said had been “kidnapped” by the Americans in Mecca, Saudi Arabia, and another Iranian he said they had abducted in Turkey.

He was apparently alluding to former deputy defense minister Ali Reza Asgari who went missing in Turkey in February 2007. Iran’s police chief said at the time that Western intelligence services might have kidnapped him.

Dolatabadi, the Iranian prosecutor, said the case of a Danish student detained during a rally on November 4 to mark the 30th anniversary of the seizure of the U.S. embassy was under investigation.

“This accused Danish citizen has introduced himself as a reporter but he holds no official press accreditation. Investigations about him continue,” he said. “Today the Danish embassy lawyer was allowed to meet the prisoner.”

Police detained more than 100 people during clashes with opposition supporters in Tehran last week. IRNA said a reporter from Agence France Presse who was detained in the protests was among five people released on Saturday.

Clotilde Reiss, a French teaching assistant, was arrested in Iran on spying charges on July 1 in connection with the post-vote unrest. She was released on bail in August but not allowed to leave the country.