According to the prosecutor, the man had shot the woman sometime between the 13th and the 15th May and then dumped her body in Lake Mälaren. The body was found two months later in Ekerö, on the outskirts of Stockholm.
Investigators did not find the murder weapon and there is no forensic evidence to tie the accused man to the murder.
The district court said that some circumstantial evidence indicated that the man could not be ruled out as the killer, but it judged that investigators had not succeeded in providing sufficient support for their case against him.
The Kenyan woman was seven months pregnant at the time of the murder and had been living illegally in Sweden for four years. The motive for the crime, according to the prosecutor, was that the man was the father of the baby and the woman refused to have an abortion.