A$AP Rocky was found guilty by a judge in Sweden on Wednesday for his role in an assault before his appearance at a music festival.

The 30-year-old rapper, whose real name is Rakim Mayers, departed Stockholm, Sweden, earlier this month and arrived in the U.S. after being detained in the country since July 3. The Harlem native was accused of beating 19-year-old Mustafa Jafari on June 30 outside a fast-food restaurant in central Stockholm. He pleaded not guilty at the start of the three-day trial, saying that he acted in self-defense when Jafari and another man would not leave him and friends David Rispers Jr. and Bladimir Corniel alone.

Per Lennerbrant, the presiding judge, told a news conference that "the evidence in the case has been complex."

KAMALA HARRIS DISSES TRUMP FOR 'MISUSE OF POWER' IN A$AP ROCKY CASE

Lennerbrant said that Jafari was struck in the back of the head with a bottle but "it could not be established by whom," adding that "this has affected the assessment of the seriousness of the crime."

The three avoided prison sentences. They were given conditional sentences and also ordered to pay a total of 12,500 kronor ($1,307) in compensation.

The rapper and his friends were allowed to leave Stockholm for Los Angeles on Aug. 2 and were not required to be present for the verdict.

SWEDISH PROSECUTORS DROP INVESTIGATION INTO MAN IN FIGHT WITH A$AP ROCKY

The courts said the defendants "were not in a situation" where they were entitled to self-defense and that they "assaulted the victim by hitting and kicking him."

Testifying in court, Jafari said his memory of the events was confused because of the blows to his head he received during the brawl. He had told police earlier that he got angry as his headphones were broken during the initial argument with a bodyguard.

TRUMP 'DISAPPOINTED' IN SWEDISH PRIME MINISTER OVER A$AP ROCKY DETENTION

A$AP ROCKY FAN THREATENED TO BLOW UP SWEDISH EMBASSY

A full-scale brawl ensued shortly afterward and prosecutors allege that Rocky and his bodyguards — Rispers and Corniel — beat and kicked Jafari while he was on the ground. They said Jafari was hit with a bottle.

One of the witnesses to the assault revised her story from initial police reports, testifying Friday that she didn't actually see Rocky hit Jafari with a bottle — a key focus of the trial. She and a friend, testifying anonymously at Stockholm District Court, both maintained that they did see Rocky and his partners assaulting Jafari.

RAPPER RZA SAYS A$AP ROCKY IS A 'HOSTAGE' IN SWEDEN

Jafari claimed the rapper pushed him to the ground. The prosecution played video footage in court showing Rocky throwing a young man to the ground, and photos showed the alleged victim's cuts, bruises and blood-stained clothes.

The case drew the attention of American celebrities and Rocky's fellow recording artists, including Sean "Diddy" Combs and Justin Bieber. A social media campaign, #JusticeForRocky, has been pressing for his release.

The issue also became a topic of a U.S.-Swedish diplomatic spat.

CLICK HERE TO GET THE FOX NEWS APP

President Trump intervened on behalf of the rapper while he was jailed, and called Swedish Prime Minister Stefan Lofven, offering to personally guarantee his bail, but the Swedish leader said he couldn't interfere in a legal case. Trump later cheered the release of Rocky and his bodyguards.

The Associated Press contributed to this report