Finnish police said one woman and three men were shot dead Thursday morning at the Sello shopping mall in Espoo, six miles (10 kilometers) west of Helsinki.
The gunman was identified as 43-year-old Ibrahim Shkupolli, an immigrant who had been living for several years in Finland. Police said he killed his ex-girlfriend in a nearby apartment before heading to the mall
The ex-girlfriend, a Finnish woman born in 1967, also worked at the mall and had taken out a restraining order against Shkupolli, police said.
Witnesses said panic erupted at the mall, one of the Nordic region's largest, when the shots rang out. Hundreds of mall workers were evacuated to a nearby library and firehouse, trains were halted and helicopters brought in as police launched a manhunt for the heavily armed killer.
After several hours, a body was found in Shkupolli's home, which police believed to be the killer himself. Police refused to confirm the exact identity immediately, but said the cause of the death appeared to be suicide.
Police refused to discuss Shkupolli's nationality, but Finnish media reported he was an ethnic Albanian from Kosovo.
At a news conference, police officials refused to say whether the four killed at the mall had been targeted by Shkupolli.
The midmorning slayings shocked hundreds of people who had gone shopping early on New Year's Eve. One witness told the state broadcaster YLE that a gunman dressed in black began randomly shooting at people on the second floor of the mall.
"There were loads of people who were crying, and many vendors who were completely panicked," the unnamed witness said.
Another female witness told YLE radio news she saw the suspect carrying a long-barrelled pistol and rushing past the cashier line at Sello's Prisma supermarket, where the slayings took place.
Finland, a nation of 5.3 million, has 1.6 million firearms in private hands, a long tradition of hunting and ranks among the top five nations in the world in civilian gun ownership.
Politicians, social workers and religious leaders have all urged tighter gun laws, more vigilance of Internet sites and more social bonding in the small Nordic nation, which is known for its high suicide rates, heavy drinking and domestic violence.
Previous shootings in Finland have been linked to schools. In September 2008, a lone gunman killed nine fellow students and a teacher at a vocational college before shooting himself in the western town of Kauhajoki. In November 2007, an 18-year-old student fatally shot eight people and himself at a high school in southern Finland.
Both young men in those attacks fired guns in YouTube clips posted before the shootings, shot themselves in the head and used .22-caliber handguns bought from the same store.