The attacks took place on Wednesday evening, with the first target being the Midnight shisha bar in Hanau city centre.
The suspect, identified by German authorities as Tobias R, was searched for in an hours-long manhunt through Wednesday night and the early hours of Thursday morning.
Police said the attacker shot himself and his 72-year-old mother at home and also confirmed that he held a hunting licence.
Bild newspaper said that the gunman had left behind a letter of confession, in which he expressed extreme right-wing views.
Hesse Interior Minister Peter Beuth said, “there is definitely a xenophobic motive”.
Angela Merkel vowed to do everything within her power to inform the public of the attacker’s background, she said: “There are many indications at the moment that the perpetrator acted on right-wing extremist, racist motives, out of hatred towards people of other origins, religion or appearance.”
The Hanau Mayor, Claus Kaminsky, spoke out saying, “you could not imagine a worse night. It will of course keep us busy for a long, long time and remain a sad memory. I’m deeply moved.”