A man has confessed to an attack on a synagogue in Germany in which two people died, and admitted a far-right, anti-Semitic motive, during a hearing with an investigating judge.

Stephan Balliet, 27, spent several hours giving evidence before a federal court judge about the attack in the eastern city of Halle.

He was arrested on Wednesday after a 40-year-old woman was shot dead in front of Halle's synagogue.

A man aged 20 was also fatally shot.

He was attacked inside a kebab shop after the gunman tried unsuccessfully to storm the synagogue, firing on the door several times.

Stephan Balliet fires shots in Halle, Germany, on 9 October 2019
The gunman streamed his attack online and published a far-right manifesto

Inside the synagogue, 51 people were marking Yom Kippur, the holiest day in Judaism. Investigators believe his intention was to carry out a massacre and have revealed that 4kg (9lb) of explosives were found in his car.

People mourn at the marketplace after yesterdays shooting on October 10, 2019 in Halle, Germany
People in Halle paid their respects late on Thursday to the two people killed in the gun attack

Stephan Balliet faces a double murder charge as well as seven counts of attempted murder. Before he was captured, he also wounded a man and a woman. He is now being held in pre-trial detention.

His lawyer Hans-Dieter Weber told Germany's public broadcaster, Südwestrundfunk, that his client stood by his actions.

"It would be nonsensical to deny it, and he didn't do that. In his view of the world, he blames others for his own misery and that's what ultimately triggered his action," the lawyer said.

The gunman streamed his attack online for 35 minutes and published a far-right manifesto. Prosecutors say it is too early to say if he had accomplices and whether he was part of any far-right group.