People place down flowers and candles at the marketplace in the old town of Halle, Germany, Friday, Oct. 11, 2019. A heavily armed assailant ranting about Jews tried to force his way into a synagogue in Germany on Yom Kippur, Judaism's holiest day, then shot two people to death nearby in an attack Wednesday that was livestreamed on a popular gaming site. (AP Photo/Jens Meyer)

BERLIN (AP) — German media say the suspected gunman in a botched attack on a German synagogue that ended in the deaths of two people outside the building has admitted carrying out the shooting.

The German man, identified by prosecutors as Stephan B., was ordered held in custody pending formal charges at a closed-door hearing before a judge on Thursday night.

He is suspected of two counts of murder and seven of attempted murder from the attack in the city of Halle.

News agency dpa reported that the man admitted to the crime and a right-wing extremist motive, and federal prosecutors say he testified for several hours.

His lawyer, Hans-Dieter Weber, told broadcaster Suedwestrundfunk on Friday "it would be pointless to dispute anything, and he didn't do that."

The attack happened on Yom Kippur, Judaism's holiest day, and was broadcast live on a popular streaming site.

People mourn at the marketplace in the old town of Halle, Germany, Friday, Oct. 11, 2019. A heavily armed assailant ranting about Jews tried to force his way into a synagogue in Germany on Yom Kippur, Judaism's holiest day, then shot two people to death nearby in an attack Wednesday that was livestreamed on a popular gaming site. (AP Photo/Jens Meyer)
A man in a white overall is escorted by Police officers as he arrives at the federal prosecutor's office in Karlsruhe, Germany, Thursday, Oct. 10, 2019. A German prosecutor says the suspect in Wednesday’s attack in the German city of Halle wanted to carry out a 'massacre' in a synagogue. (Uli Deck/dpa via AP)