US President George W Bush has said he would like to close the US prison camp at Guantanamo Bay and send many detainees back to their home countries.
However, he said not all the inmates would be returned - some would need to be put on trial in the US because they were "cold-blooded killers".
The comments came after talks with EU leaders at a one-day summit in Vienna.
Mr Bush then flew on to Hungary, where he was due to commemorate the country's 1956 uprising.
The US has faced mounting pressure over Guantanamo Bay, the camp that currently holds about 460 detainees, mostly without charge.
Mr Bush has said before that he wants to close the camp.
But the BBC News website's world affairs correspondent Paul Reynolds says his remarks on Wednesday were significant because he revealed more about how he might bring this about.
Leaders at the summit also focused on other issues:
- Mr Bush urges Iran to respond within "weeks, not months" on an international package of incentives to get Tehran to halt its enrichment programme
- He warns North Korea against testing a long-range missile believed to be capable of reaching the US, saying it must abide by international agreements
- The two sides pledge to push for a world trade agreement that would benefit poorer nations
- They agree to strengthen co-operation over the search for long-term energy security.
Releases and trials
Mr Bush said he understood European concerns over the US detention camp in Cuba.
"I'd like to end Guantanamo. I'd like it to be over with," he said.
He said 200 detainees had been sent home, and most of those remaining were from Saudi Arabia, Yemen and Afghanistan.
But he added that there were some detainees "who need to be tried in US courts".
"They will murder somebody if they are let out on the street."
Austrian Chancellor Wolfgang Schuessel, who hosted the talks, welcomed Mr Bush's comments on an eventual closure - and offered to help negotiate with countries that are to take detainees back.
Calls to close Guantanamo have increased following the first apparent suicides by prisoners earlier this month.
Lawyers say the three men who are said to have hanged themselves had been driven by despair.
Dozens of prisoners have been released without charge, but others have been held for up to three years without being charged or facing trial.
At present only 10 inmates face trial by military tribunal and the US Supreme Court is to rule by the end of June on the legality of the tribunals.
European leaders and human rights groups have said procedures at Guantanamo Bay violate the rule of law and undermine the fight against terrorism.
"We can only have a victory in the fight against terror if we don't undermine our common values," Mr Schuessel said.
The Bush administration has denied allegations of abuse at Guantanamo, and the military says it provides safe, humane care and custody of the detainees