The Malaysian government says it was prepared to waive diplomatic immunity for a defence attaché charged with robbery and assault with intent to rape a woman in New Zealand.
However, it says the New Zealand Government offered an alternative so the 35-year-old could return to Malaysia.
Muhammad Rizalman bin Ismail appeared in the Wellington District Court in May this year. Police said he was arrested in the Wellington suburb of Brooklyn on 9 May and charged after he followed a 21-year-old woman.
Mr Rizalman was remanded at large and granted name suppression, but later claimed diplomatic immunity and fled the country.
At a news conference in Putrajaya on Tuesday, Malaysia's Foreign Minister Anifah Aman told media that his government was prepared to waive diplomatic immunity so Mr Rizalman could be tried on the charges in New Zealand.
But Mr Aman said they decided to take up an offer to recall him instead, and asked that the New Zealand Police seal all documents relating to the matter and drop all charges against the man.
In a statement late on Tuesday night, New Zealand's Foreign Affairs Minister Murray McCully said he has spoken to Mr Aman to clarify any misunderstanding relating to the accused's return home.
Mr McCully said he has been assured that the Malaysian government's decision to refuse New Zealand's request for immunity to be waived was driven by that country's Chief of Defence's desire to put in place a robust judicial process to deal with the matter.
Mr McCully said the Malaysian government believed that that would be acceptable to New Zealand.
Earlier, Prime Minister John Key said he wanted Mr Rizalman to be tried in New Zealand, but was sceptical that he would be sent back now. He said the man would get a fair trial in New Zealand and his life would not be in danger.
Ram Anand, a reporter for news agency MalaysiaKini, told Radio New Zealand's Checkpoint programme that Mr Rizalman is undergoing psychiatric tests and could face charges in a military court.
At the High Court in Wellington on Tuesday afternoon, Justice Collins lifted the suppression order preventing publication of any details relating to Muhammad Rizalman bin Ismail.
Media including Radio New Zealand sought an urgent court hearing following reports that the Ministry of Foreign Affairs in Malaysia was holding a news conference to discuss an "important issue".
The lawyer representing media, Robert Stewart, told the court this would mean that the "rest of the world" would know details of the man's offending, but New Zealand media couldn't publish them.
Police did not oppose lifting name suppression, saying there was no relationship between the complainant and the defendant. There was also no risk of prejudicing a fair trial because Mr Rizalman claimed diplomatic immunity and left the country.
Barbara Hunt, the duty solicitor at Mr Rizalman's first appearance, said he sought suppression because of the nature of the charges and the need to tell his family.
Robert Stewart later told Radio New Zealand's Checkpoint programme that lifting the suppression is a victory for media freedom in New Zealand.
"Certainly in relation to keeping the public informed, I like to have days like this where we're able to overturn suppression orders where they're no longer required and we're able to get the story out."
Father wants immunity scrapped
The father of a woman killed in a car crash in 1984 caused by a diplomat wants the immunity system ended, saying abuse of the arrangement is widespread.
Sacha MacFarlane was 20 when she died in a head-on crash in Wellington caused by a Chilean diplomat who had been drinking and crossed the centre line. Luis Felipe Lopez left the country and it took 25 years to get an apology.
Sacha's father Kester MacFarlane told Radio New Zealand's Morning Report programme on Tuesday that diplomatic immunity is almost an excuse for people to flout the local laws.
"They're above the law, they're just not answerable," he said.