A German man has been arrested after an elderly woman and a cyclist were shot dead near the town of Ansbach, police have said.
The suspect fired at them from his car, killing both at the scene, in what officials said were random killings.
He was later detained after being overpowered by workers at a petrol station where he is alleged to have stopped and threatened staff.
The suspected attacker has been identified only as Bernd G, 47.
Initial reports said the suspect was an 18-year-old.
His motive is unclear, and he is undergoing psychiatric assessment.
The first shooting came in the village of Tiefenthal, the second a short time after in nearby Rammersdorf, sparking a major police manhunt.
A pedestrian and tractor driver were also attacked but escaped unharmed.
Siegfried Hess, the mayor of Leutershausen, which incorporates Tiefenthal, said he was “stunned”.
“In a place with 5,500 inhabitants where we have always had a quiet life, we only know this kind of situation from television,” he told the DPA agency.
The Bavarian Interior Minister Joachim Herrmann said the “courageous intervention” of the petrol station employees had prevented something even worse from happening.