Rocky and the other men are free until Aug. 14, when judges are expected to announce a verdict in the assault case against them, a Swedish court announced Friday.
It wasn't immediately clear from the decision by the Stockholm District Court whether the three individuals, all American citizens, would be able to leave the country.
Hours after his release the 30-year-old rapper, whose real name is Rakim Mayers, posted on instagram.
"Thank you from the bottom of my heart to all of my fans, friends, and anyone across the globe who supported me during these last few weeks," wrote Mayers.
"I can't begin to describe how grateful I am for all of you. This has been a very difficult and humbling experience."
The post had already been liked more than 2 million times since it was posted.
The case has also drawn the attention of celebrities who stared a social media campaign that was pressing for the rapper's release.
Many of them replied to Mayers post including hip-hop stars Big Sean, Pharrell, and actors Michael B Jordan and Dwayne "The Rock" Johnson
"Come home to your family Brotha," Johnson wrote.
President Donald Trump also posted about the rapper's release.
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
"It was a Rocky Week, get home ASAP A$AP!" tweeted the President.
The trial has created a stir in U.S.-Swedish diplomatic relations after President Trump weighed in to support the Grammy-nominated recording artist. Trump has spoken with Swedish Prime Minister Stefan Lofven, offering to personally guarantee A$AP Rocky's bail, but the Swedish leader said he couldn't interfere in a legal case.
Prosecutors asked that Mayers get a six-month sentence during closing arguments Friday. Mayers told the court he thought community service would be a proper punishment for him.
The development comes after a witness in the A$AP Rocky assault case revised her story from initial police reports, testifying in a Swedish court Friday that she didn't actually see the American rapper hitting a man with a bottle.
The young woman and her friend, testifying anonymously, were questioned via video link at Stockholm District Court.
Witness testimonies were the highlight of the third day of the trial where Mayers and two other suspects are accused by prosecutors of beating 19-year-old Mustafa Jafari on June 30. The rapper's bodyguard, identified as Timothy Leon Williams, also testified Friday.
Whether or not Jafari, who got into an argument with Mayers' entourage in Stockholm, was hit with parts or a whole bottle has become one of the key issues at the trial.
Both women who testified Friday maintained their previous statements to police that they saw Mayers and his partners beating and kicking Jafari.
But one of the women recanted what she witnessed with the bottle. She said she heard the bottle being crushed, though she couldn't say whether Mayers' entourage threw the bottle to the ground or hit Jafari with it.
She said she didn't see Mayers holding a bottle during the scuffle. Her friend testified that she didn't see anyone hitting Jafari with a bottle.
"Everything happened very quickly. We were scared for our lives," the first woman told the court in Swedish. "He (Jafari) was bleeding. He showed his injuries on his hand. He also said he had a sore back."
Williams' testimony closely mirrored what Mayers told the court Thursday , adding that the situation was made more complicated due to the language barriers between the rapper's group and Jafari. His bodyguard said Friday he asked Jafari to "go away" when he approached the group a second time outside the fast-food restaurant in central Stockholm.
"I knew something's not right about him. I'm noticing it because I'm a bodyguard," Williams said in English. "And now, I'm looking at him like, 'Yo, what's wrong with you?' I'm looking at him and saw that his eyes were really glossy, like he's on something."
Williams then went on to explain the details of the brawl, explaining how he grabbed Jafari by the shoulders and took him away from Mayers and the rest of his crew.
Mayers had also testified earlier this week that he suspected Jafari and his friend were under the influence of some drug, which officials have not yet commented on.
The rapper pleaded not guilty at the start of the trial Tuesday, saying he acted in self-defense when Jafari and another man would not leave them alone. He had been behind bars since he was arrested on July 3.