An Indian doctor was freed from custody after Australia's chief prosecutor said Friday that a charge linking him to failed terrorist bombings in Britain was a mistake.

Prosecutors withdrew the charge against Mohamed Haneef in the Brisbane Magistrates Court after a review of the evidence by the federal Director of Public Prosecutions Damian Bugg found that his office should never have recommended it.

"Mistakes are embarrassing. You're embarrassed if you do something wrong," Bugg told reporters in Canberra. "I'm disappointed that it's happened and I will first thing next week try and obtain a better understanding of how it came about."

• Get complete coverage in FOXNews.com's War on Terror Center.

The government responded by saying Haneef, 27, would be freed from custody while Immigration Minister Kevin Andrews considers whether he will change his decision to revoke the 27-year-old doctor's visa.

Haneef was released from prison in the eastern city of Brisbane in Queensland state. His lawyer Peter Russo would not say where Haneef planned to live while the government reviewed whether to reinstate his visa.

Andrews said Haneef was free to stay where he liked as long as he reported daily to a department official.

His wife, Firdaus Arshiya, told reporters in Bangalore she hoped her husband would fly home to India within days.

"I'm happy he's been proved innocent," she said.

E. Ahmed, India's junior foreign minister, said India would support Haneef's request for a bridging visa so that he could leave Australia on his own accord, rather than be deported.

Russo said his client was pleased with the chief prosecutor's decision.

"He's quite upbeat and relaxed as you can imagine. He's just had some very serious charges dropped," Russo told reporters in Brisbane. "My client will be patient ... until this is resolved."

Civil liberties groups have criticized the handling of the case, saying that police seemed to have bungled the evidence and that Andrews' decision to pull Haneef's visa just hours after he was granted bail appeared to undermine the court's authority.

Haneef has been in custody since July 2, when he was arrested at Brisbane International Airport as he was about to fly to India on a one-way ticket.

Haneef had been charged with providing reckless support to a terrorist organization because he gave his mobile phone SIM card to his second cousin, Sabeel Ahmed, in July last year. He had faced up to 15 years in prison if convicted.

Bugg said there was insufficient evidence to prove the charge, describing the mistake as "upsetting."

British police have charged Ahmed, 26, with withholding information that could prevent an act of terrorism. His brother, Kafeel Ahmed, is believed to have set himself ablaze after crashing into Glasgow Airport and remains in a Scottish hospital with critical burns.

In Brisbane, prosecutor Alan MacSporran said authorities had erred in telling the court that Haneef's SIM card had been discovered inside the vehicle used to attack the Glasgow airport. The card was found in the possession of Sabeel Ahmed in Liverpool, more than 300 kilometers (186 miles) from the attack scene.

A second error related to claims that Haneef had lived with the Ahmed brothers in Liverpool before he moved to Australia from Britain last year. The trio had only spent time together in Britain.

Haneef has denied knowing anything about the British bomb plot, and told police he only gave his SIM card to his cousin so he could take advantage of extra minutes left on the account.

He told police he was rushing to India join his family because his daughter had been born a few days earlier by emergency Caesarean section.

A court ordered Haneef's release on bail last week, but Andrews kept him in prison by canceling his visa on character grounds, based on information provided by the federal police.

Haneef is due to appeal the decision to revoke his visa in court on Aug. 8. If his appeal fails, Haneef could be deported to India, an outcome he opposes.

Visit FOXNews.com's War on Terror Center for complete coverage.