A Swedish judge ordered ASAP Rocky released from jail Friday, pending the verdict in the Harlem rapper's assault trial.

He is allowed to leave Sweden prior to judgment being reached Aug. 14, but his lawyer did not immediately say whether the rapper plans to leave.

President Donald Trump, who has been a vocal supporter of the rapper in the criminal case, hailed his release from custody.

"A$AP Rocky released from prison and on his way home to the United States from Sweden," Trump tweeted. "It was a Rocky Week, get home ASAP A$AP!"

A$AP Rocky released from prison and on his way home to the United States from Sweden. It was a Rocky Week, get home ASAP A$AP! — Donald J. Trump (@realDonaldTrump) August 2, 2019

The rapper took to Instagram to thank his supporters for seeing him through the past few weeks.

"I CANT BEGIN TO DESCRIBE HOW GRATEFUL I AM FOR ALL OF YOU THIS HAS BEEN A VERY DIFFICULT AND HUMBLING EXPERIENCE," he wrote.

The highly-publicized trial ended Friday with prosecutors asking the court to convict the 30-year-old American and impose at least a six-month jail sentence.

In closing arguments, the prosecutors said that the case involved too much violence to support ASAP Rocky's argument of self-defense during a confrontation with 19-year-old Mustafa Jafari in Stockholm on June 30.

Prosecutors allege that the musician and two companions "deliberately, together and in agreement" kicked and hit Jafari, including with a bottle.

However, the rapper's lawyer said in closing remarks that nothing was premeditated or coordinated about the confrontation. He also referred to footage showing ASAP Rocky, whose real name is Rakim Mayers, standing on the alleged victim's arm and said it wasn't the same as kicking.

Mayers and two members of his entourage have been in custody in Stockholm since July 3. They pleaded not guilty earlier this week to assault charges.

Several witnesses, including the rapper's bodyguard, gave testimony in court Friday, which marked the trial's third day.

The bodyguard said that Jafari approached the group twice and was told to go away multiple times. He said Jafari, whom he described as "hostile," "swung with [a] closed fist" but that the "punch didn't land," according to media reports emanating from the courtroom. Jafari then "threw headphones at him," the bodyguard said, adding that Mayers stepped in to protect him because he was outnumbered.

Mayers had told the court Thursday that "everything seemed to be going fine" when two men approached him and his companions. One of the men, Jafari, started talking to his security guard. "Next thing I know, my security guard was lifting one of them," the rapper testified, adding that the situation "got a little scary."

Jafari also took the stand Thursday.

Besides Mayers' bodyguard, the other witnesses questioned Friday included a friend of Jafari's who was with him the day of the alleged assault. He said he saw Mayers "throw" his friend, according to reports from the courtroom.

Although Mayers has posted videos on Instagram that he says vindicate him, prosecutors say that the footage had been selectively edited to leave out damning details.

A verdict is expected soon. The case, which has attracted worldwide attention and support for Mayers from many celebrities such as Kim Kardashian West and Jada Pinkett Smith, also received an extraordinary intervention from Trump, who sent the top U.S. official in charge of hostage affairs to attend the trial in Stockholm.

Because of his detention, Mayers had to cancel a flurry of European shows in July.

CORRECTION (Aug. 2, 2019, 2:28 p.m. ET): An earlier version of this article misstated the terms of ASAP Rocky's release. He is allowed to leave Sweden before a verdict is announced.