A$AP Rocky has just been charged with a crime after spending weeks in a Swedish jail ... prosecutors just hit him with Assault Causing Actual Bodily Harm stemming from a street brawl in the country's capital ... and if convicted he could spend 2 years behind bars.

The prosecutor said A$AP will continue to be held in jail pending a trial ... and the trial date has not been set, although it could be today. A rep for the prosecutor tells TMZ the trial will be held within the next 2 weeks. The prosecutor expects the trial will last 3 days.

Two members of Rocky's crew have also been charged with the same crime and they will also be held pending trial.

The Swedish prosecutor just boasted he had access to more information than people on the internet. He said he's reviewed video and also talked to witnesses, and determined the claims by Rocky and his 2 crew members of self defense and provocation didn't hold water, despite the fact the alleged victim is the one who unrelentingly harassed and attacked Rocky and his crew first.

The prosecutor says he also considered the alleged victim's statement, which he says was supported by witness statements. We're told the alleged victim admits striking A$AP's bodyguard with a set of headphones, but only after the bodyguard lifted him off the ground by his neck, so the prosecutor viewed the headphones attack as self defense. BTW, the lifting by the neck is not on video, and interestingly, if the prosecutor really felt the bodyguard was the aggressor he would have been presumably charged ... and the bodyguard has already been cleared.

The charge has been 3 weeks in the making ... A$AP has been in jail alongside two of his associates since turning himself in to Swedish authorities earlier this month. Prosecutors inadvertently played their hand last week, announcing they were going to charge the Harlem rapper ... and on Thursday the hammer finally dropped.

The only good news for Rocky ... he and his crew will not be charged with Aggravated Assault, a more serious crime which carries a 6-year prison sentence.

Play video content

As we reported ... the man who attacked A$AP's crew in the streets of Stockholm will NOT be prosecuted for any crime, even though he incited the violence and kept harassing Rocky until he eventually snapped.

In the initial video ... you hear A$AP attempting to diffuse the situation, playing peacemaker and saying no one wants to go to jail.

Play video content TMZ.com

In video from the street brawl ... A$AP finally loses his cool, throwing his attacker to the ground and absolutely pummeling the guy.

The Swedish justice system is not bowing to pressure from the U.S. government ... with the Prime Minister essentially telling President Trump and the State Dept. to butt out after their attempts to free A$AP.

Play video content 7/22/19 TMZ.com

A$AP's mom thinks Sweden is out to get her son, and she believes it's because he's black ... even though A$AP himself says he won't make race an issue in his assault case.