Siti Aisyah smiled as she was ushered through a pack of journalists and into a car outside the court, where she had been on trial alongside a Vietnamese woman for the murder of Kim Chol at Kuala Lumpur airport in February 2017.
"I feel happy. I did not know this will happen. I did not expect it," said Aisyah, who was wearing a red headscarf.
It was a surprise move as the Shah Alam High Court, outside Kuala Lumpur, had been due only to hear Hương’s testimony on Monday. Her lawyers said they were seeking an adjournment.
The women, in their 20s, had always denied murder, saying they believed they were taking part in a prank and were tricked by North Korean agents into carrying out the Cold War-style hit using VX nerve agent.
Their lawyers had presented them as scapegoats, saying that authorities were unable to catch the real killers.
Four North Koreans -- formally accused of the murder alongside the women -- fled Malaysia shortly after the murder.
The trial, which began in October 2017, was due to resume on Monday with the defence stage of proceedings after a break of several months.
But at the start of the hearing, prosecutor Muhammad Iskandar Ahmad requested that the murder charge against Aisyah be withdrawn and that she be given a discharge.
He gave no reason for the request.
"Siti Aisyah is freed," judge Azmin Ariffin told the court, as he approved a request. "She can leave now."
Indonesian ambassador to Malaysia Rusdi Kirana told reporters outside court: "We are pleased with the court decision. We will try to fly Siti back to Indonesia today or as soon as possible."
Prosecutors had presented their case in the first stage of the trial.
Witnesses described how the victim died in agony shortly after being attacked.
In August, a judge ruled there was sufficient evidence the suspects had engaged in a "well-planned conspiracy" with the four North Koreans to murder Kim, and ordered that the trial continue to the defence stage.