UNITED NATIONS (Reuters) - The next U.S. president, whether it is Barack Obama or John McCain, will likely shut down Guantanamo Bay prison camp but may decide to keep some prisoners indefinitely, a U.N. rights envoy said on Wednesday.

The prison at Guantanamo Bay, Cuba, and the system for trying its detainees, has been widely condemned by human rights groups and governments around the world, including close allies of the United States, who say it does not meet international legal standards.

Both candidates seeking to succeed President George W. Bush -- Republican Sen. McCain and Democratic Sen. Obama -- have pledged to close the detention center where some 255 suspected members of al Qaeda, the Taliban and associated groups are detained. The prison once held as many as 600 detainees.

Martin Scheinin, U.N. special rapporteur for human rights in the fight against terrorism, told reporters he expected the next U.S. president to swiftly follow through on his promise to close down the prison.

This will lead to the “release of those detainees who are ready for release, who have already been determined as posing no threat,” said Scheinin.

It will also lead to trials for those suspected of serious crimes who have been deemed ready for trial.

“I would expect the trials to be taken to (U.S.) federal courts,” Scheinin said, adding that he was confident the suspects would receive fair trials.

But for those who are neither ready for release or trial, the new administration may decide to seek legislation to create a “regime where indefinite detention would be continued.”

“I strongly recommend against that solution,” Scheinin told reporters after briefing the U.N. General Assembly’s Third Committee on social, humanitarian and cultural affairs.

He said the current legal basis for indefinite detention of terrorism suspects at Guantanamo Bay was deeply flawed.

“But replacing it with an ex post facto law authorizing, after so many years, continued detention -- unavoidably it would be assessed by international human rights bodies as constituting a form of arbitrary detention,” he said.

He also chided Canada for refusing to request extradition of a 22-year-old Canadian captive who was 15 years old when he was detained after a firefight in Afghanistan in 2002.

Scheinin said Omar Khadr was a juvenile at the time he was alleged to have thrown a grenade that killed a U.S. soldier.

“It is troubling that Canada is not doing what other countries have done in order to get their citizens or even residents out of Guantanamo,” Scheinin said.