A Malaysian military officer extradited to New Zealand to face sexual assault charges was released on bail Tuesday in a case that has raised questions about the moral implications of the Vienna Convention, which offers special legal protections to diplomats and embassy staff.

Wellington District Court Judge Arthur Tompkins ruled Muhammad Rizalman Ismail could be released from custody if he followed certain conditions, including surrendering his passport, not going out at night, and having no contact with his accuser. Rizalman had been jailed since returning to New Zealand on Saturday, five months after leaving the country under the protection of diplomatic immunity.

Rizalman was working at the Malaysian Embassy in Wellington when he was arrested May 9 for allegedly following a 21-year-old woman home and assaulting her. He was charged with burglary and assault with the intent to rape, each of which carries a maximum prison sentence of 10 years.

The incident has proved diplomatically embarrassing to both countries, which have offered varying accounts of why the official was initially allowed to leave.

Both countries hope that Rizalman's return to New Zealand will help ease concerns about the implications of diplomatic immunity. He was extradited under an agreement between the two countries, which don't have a formal extradition treaty. He will now face the charges as an ordinary citizen without diplomatic immunity.

Malaysian Embassy officials have been attending the court proceedings. They said Saturday they were there to offer Rizalman assistance but declined further comment.

Rizalman initially returned to Malaysia less than two weeks after he was arrested.

When the case came under media scrutiny, New Zealand officials at first insisted that Malaysia had invoked the diplomatic protections against New Zealand's will. But Malaysia's Foreign Affairs Minister Kenyataan Akhbar countered that "the New Zealand side had offered an alternative for the accused to be brought back to Malaysia."

New Zealand officials then conceded they may have given the mistaken impression they didn't oppose Rizalman returning home. New Zealand Foreign Minister Murray McCully apologized to the alleged victim, Tania Billingsley, for "the poor management of this case."

Billingsley in July decided to identify herself and speak out publicly, saying she felt frustrated and angry Rizalman had been able to leave.

His return to New Zealand came after months of delay as Malaysia's government said Rizalman had to undergo physical and mental examinations to ensure he was fit to stand trial, and lawyers drafted a special extradition document.

Malaysian officials have expressed concerns about Billingsley's decision to speak publicly, saying anybody involved in a case shouldn't be speaking in way which could prejudice a defendant's right to a fair trial.

The 1961 Vienna Convention spells out the special protections afforded to diplomats and their embassy staff. Diplomats enjoy full immunity from local laws; staff are immune from criminal prosecution. The home country can choose to waive immunity in any particular case.

The United Nations says the convention reflects practice from the earliest historical times and these days allows embassies to act without fear of local harassment or coercion. But some worry the protections enable diplomatic staff to sometimes avoid facing consequences for their actions.