The suspect was filmed wearing a helmet shooting into a local street |
The suspect broadcast the attack on a popular live-streaming platform before being arrested.
The video, which has now been removed, showed him making anti-Semitic comments to camera before driving to a synagogue in Halle and shooting at its door.
After failing to get in, the gunman shot dead two people nearby.
The suspect is a 27-year-old German who acted alone, according to local media.
"According to the federal prosecutor there are sufficient indications for a possible right-wing extremist motive," German Interior Minister Horst Seehofer said.
Videos from the scene appear to show the suspect wearing military-type clothing and using several weapons in the attack.
German Chancellor Angela Merkel attended a memorial vigil for the victims at Berlin's main synagogue.
How did the attack unfold?
The attack happened in the city of Halle at about 12:00 local time (10:00 GMT) on Wednesday.
The attempted attack on the synagogue was captured on a surveillance camera, said Max Privorotzki, leader of the local Jewish community.
"We saw via the camera system at our synagogue that a heavily armed perpetrator with a steel helmet and a gun tried to shoot open our doors," he told the Stuttgarter Zeitung newspaper.
"The man looked as though he was from the special forces... But our doors held."
Mr Privorotzki said about 70 or 80 people were inside at the time.
After apparently becoming frustrated at failing to get in, the suspect then allegedly shot into the street and killed a woman close to the synagogue, before killing a man in a local kebab shop.
A witness at the shop told German N-tv news the gunman had been wearing camouflage when he opened fire on the venue.
"The man came up to the doner shop, he threw something like a grenade, it didn't explode, and he opened fire with an assault rifle. I hid in the toilet," the witness said.
Two people with gun wounds have had surgery at the city's university hospital, a spokesman told AFP news agency.
What is known about the suspect?
Police say the man was arrested after fleeing the scene. He has not been officially named but local media suggest he is a 27-year-old German.
Initial reports suggested other people may have been involved, but a local police lockdown has now been lifted.
Streaming platform Twitch, which is owned by Amazon and is popular among game streamers, has confirmed the suspect broadcast the attack on their website.
"We worked with urgency to remove this content and will permanently suspend any accounts found to be posting or reposting content of this abhorrent act," a spokeswoman told Reuters news agency.
The video the suspect posted showed him making misogynistic and anti-Semitic statements to the camera - including denying the Holocaust.
The attack came as Jews observed Yom Kippur, Judaism's holiest day.
"That on the Day of Atonement a synagogue was shot at hits us in the heart," Foreign Minister Heiko Maas posted on Twitter. "We must all act against anti-Semitism in our country."
Security was boosted at other German synagogues following news of the attack and vigils were held on Wednesday evening.
A spokesman said Angela Merkel condemned the shooting and offered her solidarity "for all Jews on the holy day of Yom Kippur".
A minute's silence was earlier held for the victims in the European Parliament in Brussels.
The EU's President, Jean Claude Juncker, has also condemned the attack.
"I am shocked by the brutal attacks in Halle - on this day, Yom Kippur, the holiest day of the year in Judaism," he posted on Twitter. "My thoughts and prayers are with the families and friends of the victims."
Israeli Prime Minister Benjamin Netanyahu described the shooting as a "terror attack" and warned anti-Semitism was on the rise in Europe.
"I urge German authorities to continue to act resolutely against the phenomenon of anti-Semitism," Mr Netanyahu tweeted. BBC