A gunman killed three women and wounded two men late on Wednesday in the Swiss village of Daillon, opening fire from his apartment then pursuing the attack in the street, Swiss officials said.
The 33-year-old gunman, who has not been named, threatened police when they tried to arrest him and was shot in the chest before being arrested and taken to hospital, police in the Swiss canton of Valais said on Thursday. No police officers were wounded.
The shooting is likely to stir a fresh debate about Switzerland's fire arms laws that allow its male citizens to retain guns after their mandatory military service.
The Daillon gunman was a local resident who had been in psychiatric care in 2005 and was unemployed and living on welfare benefits, police said. His only previous conviction was for marijuana use.
The village is close to the town of Sion, the capital of the canton - or region - of Valais, known for its world-class ski resorts such as Verbier.
The women who died, aged 32, 54 and 79, were all shot at least twice, in the head and chest. The youngest was married to one of the injured men and they had young children together, regional public prosecutor Catherine Seppey told a news conference. The injured men were aged 33 and 63.
Police said the gunman used at least two firearms - an old Swiss army carbine and a rifle capable of firing lead shot - even though his weapons had been seized and destroyed in 2005, and he was not currently listed as having any guns.
He began firing from his apartment, shooting at people in the street and in neighbouring buildings, but later came out into the street, police said, adding that he appeared to have fired more than 20 shots.
Swiss website 20minutes.ch quoted villagers as saying the gunman had been drinking heavily. It also said he was armed with an assault rifle, but the public prosecutor did not confirm that information.