Exclusive Details

The lawyer who initially represented A$AP Rocky in his Swedish assault case was shot by someone who appears to have been lying in wait for him ... TMZ has learned.

We're told Henrik Olsson Lilja was leaving his apartment building early Friday morning in downtown Stockholm when a gunman walked up to him and shot him in the head and the chest. Cops tell us the lawyer was inside the building at the time of the attack.

The gunman jumped into a waiting SUV, which then sped off.

We don't know the lawyer's condition, but we're told he actually called the police. TMZ has seen a photo of him on the street and the head injury is too gruesome to post.

The lawyer repped A$AP when he was first taken into custody after assaulting a man who was harassing him on the streets of Stockholm. Olsson Lilja was replaced before the trial began.

So far we don't know if there's any connection to Olsson Lilja's representation of A$AP.

The shooter is still at large.