Leading state prosecutor Gerhard Neuhof said that the 47-year-old suspect arrested by police at a petrol station in nearby Bad Winsheim shortly before midday was undergoing psychiatric evaluation to determine whether he should be held in police or medical custody.
He had shown "psychiatric symptoms" while being transported away from the scene of the crime in a police car, Neuhof said.
Bavarian interior minister Joachim Hermann and police chief Roman Fertinger thanked the courageous mechanics who were able to stop the shooter when he threatened them at the Bad Winsheim Esso petrol station.
"It's thanks to them that nothing worse happened," Hermann said.
Neuhof and Ansbach detective chief Hermann Lennert explained that the suspect threatened the two men with his pistol when he entered the petrol station, but momentarily laid it down on the counter, allowing one of the cashiers to grab it and dash away.
As the man ran out of the shop, the two mechanics were able to overpower him.
The suspect, an Ansbach resident, was not previously known to the police and had no apparent connection with his victims, Neuhof said.
Police received word at 10.02 am that the man had shot an elderly woman, with the report including information about the suspect's Mercedes convertible, police chief Roman Fertinger said.
Soon afterwards, there was news of a second attack in which a cyclist was killed.
The police realized that it was a rampage shooting and activated pre-existing plans, deploying large numbers of ordinary officers and special response units as well as four helicopters to search for the suspect.
At the same time, they had to deal with an unrelated attempted bank robbery in the town of Ansbach.
The suspect attacked a number of other people, including a farmer who was out driving his tractor, but caused no further injuries other than light scratches from broken glass.
Siegfried Hess, mayor of the small town of Leutershausen where the first shooting occurred, said that he and everyone there had been "thrown off the rails" by the event.
He knew the victim very well, he said, and regularly attended her birthday parties and family events. Today was her 50th wedding anniversary.
"I am deeply affected by this act," said local councillor Jürgen Ludwig. "My thoughts are with the victims and their relatives. People in the affected districts are seriously upset - but grateful for the quick deployment of the police."
Neuhof told reporters at the press conference that the suspect had licenses for two large-calibre weapons, a pistol and a revolver. One of the two weapons was found in his car after he was arrested.
Police gather evidence at the scene of one of the shootings in Leutershausen, Ansbach district, northern Bavaria. Photo: DPA
Hess had earlier told Bayerische Rundfunk that "in a town of 5,500 inhabitants where we've always lived a tranquil life, you only know these situations from the television."
"And then something like that happens in front of your house door. You're at a loss for words," the mayor said.