Ansbach shooting
German police arrested a man suspected of shooting dead two people near Ansbach in northern Bavaria Reuters

German authorities said they are evaluating the mental health of a drive-by shooter who killed two people in a quiet Bavarian city on 10 July, before being apprehended with a brazen move by staff at a local gas station.

The 47-year-old gunman, identified only as Bernd G, went on a murdering spree in the morning, opening fire from his vehicle at different locations in and around the small city of Ansbach.

Authorities said the man, a local resident, was not known to authorities, having no prior criminal record.

Driving a silver Mercedes cabriolet registered to his father, he first shot dead a woman in her 80s in the Tiefenthal district, and then drove a few kilometres to the Rammersdorf area where he killed a 72-year-old cyclist.

A motorist and a farmer were also shot at but escaped with their lives, with the latter reporting some injuries from splinters.

Authorities said it appears victims were selected at random, as they were not connected to each other or the attacker.

A massive manhunt involving four helicopters was launched, but Bernd was eventually held by two mechanics with the help of a brave female worker at a service station in Bad Windsheim.

The woman was in fact able to snatch the shooter's gun as he briefly laid it on the counter after storming the store.

She fled with the weapon, forcing the attacker to run for his car, where police later discovered another weapon. As he exited the shop he was overpowered and subdued by two station workers.

Their courage was praised by police chief Roman Fertinger who said their actions prevented more deaths.

Bernd had a sport shooting licence for the two large calibre guns that were used in the attacks, according to prosecutors.

Reasons for the shooting were not immediately clear. Bavaria's interior minister, Joachim Herrmann, described the incident as an "ugly, incomprehensible crime".

The man, who showed signs of mental issues upon arrest, is now to be examined by a psychiatric expert, authorities said.