A German man was sentenced to life behind bars on Wednesday for the brutal murder of a pregnant headscarved Egyptian woman, a crime that sparked outrage in the Muslim world.

Alex Wiens (28) much of his face covered by a hooded top, sat motionless as the court in the eastern German city of Dresden found him guilty of murdering Marwa El-Sherbini, dubbed the "veil martyr".

The Egyptian government welcomed the sentence, saying it "served justice".

On 1 July in the same courthouse, Wiens had plunged an 18-centimetre kitchen knife at least 16 times into Sherbini (31), three-months pregnant at the time with her second child.

Her son, three-year-old Mustafa, watched her bleed to death at the scene.

Sherbini's husband, Egyptian geneticist Elwy Okaz, rushed to her aid but was also stabbed repeatedly and then shot in the leg by a police officer who was unsure who the attacker was.

Killed out of revenge

Russian-born Wiens, surrounded by four security guards as the verdict was read, was also found guilty of attempted murder and causing bodily harm for his attack on Sherbini's husband.

"He killed Marwa not out of dread or fear but out of revenge," Judge Birgit Wiegand said. "He deliberately profited from her innocence and her defencelessness."

Throughout his trial, which began under heavy security on 26 October Wiens had been uncooperative, refusing to remove his sunglasses, banging his head on the table and stamping his feet during proceedings.

After the verdict, Wiens, an ethnic German who arrived in Germany from Perm in the Urals in 2003, was handcuffed and led away, saying nothing, with his head bowed.

Egyptian foreign ministry spokesperson Hossam Zaki welcomed the court's ruling, saying: "The verdict, the maximum punishment under German law, serves justice and is considered a warning to those motivated by hate."

German Foreign Minister Guido Westerwelle said the verdict showed that violence, racial hatred and intolerance had no place in Germany.

The killing, as well as the slow reaction of Germany's politicians and media, sparked outrage in Sherbini's home country, as well as in the wider Muslim world.

In Tehran, protestors hurled eggs at the German embassy and daubed "Angie the Nazi" on walls, referring to Angela Merkel, the German chancellor.

On crutches, unsure if he will ever walk again, Okaz gave wrenching testimony during the two-week trial, telling the court how Mustafa, who now lives with family in Egypt, misses his mother.

The trial centred around Wiens' motives for the murder and whether he was fully in control of his faculties at the time.

'An unbridled hatred of foreigners'

Prosecutors said he was driven by "an unbridled hatred of foreigners." In a statement read by his lawyer, Wiens admitted being hostile to foreigners but denied this was the motive for the attack.

Wiens "voted NPD (a neo-Nazi party) because he said it was the only party that would ensure that Germany would be free of foreigners," the judge said.

In a last-minute twist, a document arrived from Russia showing that Wiens had been declared unfit for military service in 2001 because of schizophrenia.

Defence lawyers said that the stabbing had not been premeditated, that Wiens always carried a knife in his backpack, and that his psychiatric condition mitigated the crime.

The courthouse, lightly guarded when the murder took place, now resembled a maximum security prison, with some 200 police officers and snipers on hand, following death threats against Wiens, who was shielded by bulletproof glass.

The first fateful meeting of Wiens and Sherbini occurred in August 2008 in a playground. Sherbini asked Wiens to vacate a swing so her son could use it but this harmless request was met with a torrent of Islamaphobic abuse.

Wiens called her a "terrorist", "Islamist" and "whore". She pressed charges for verbal abuse and he was fined ?780 ($1168).

He appealed the conviction, bringing them together again on 1 July this year ? a day that ended in tragedy.

Outside the courtroom, around 200 people, most of them Muslims, staged a demonstration calling for the government to do more to counter racism, particularly on the Internet.