Ansbach in the southern German state of Bavaria iStock

Two people have been killed in a drive-by shooting in the Bavarian city of Ansbach, German authorities said. Police have arrested the alleged gunman after a brief manhunt.

Authorities said the attacker first opened fire from a vehicle in the Tiefenthal district, killing an elderly woman.

He then shot a cyclist dead in the Rammersdorf area, a few kilometres from the location of the first attack.

A motorist and a farmer were also shot at in the picturesque southern city but escaped unhurt, police said.

The attacker fled in a silver Mercedes cabriolet and a massive manhunt was subsequently launched, with helicopters hovering over the area.

Security forces eventually intercepted and captured the man at a gas station in Bad Windsheim, with local media reporting he is an 18-year-old.

Authorities initially warned he was armed and dangerous. Reasons for the shooting were not immediately clear.

It appears the victims were selected at random, not being connected to each other.

After the arrest was made, police said the situation was over, posing no further danger to the population. A press conference is to be held in the afternoon.