Updated

Responding to a school massacre in Finland and other deadly shootings, lawmakers on Thursday overwhelmingly backed tighter gun control for the 27-nation European Union.

The European Parliament vote comes less than a month after an 18-year-old went on a shooting rampage at a school in southern Finland, killing eight people and himself.

Under the new guidelines, only adults over age 18 would be able to buy and keep guns, with the exception of firearms for hunting and supervised target shooting.

EU member states would be required to keep detailed computer files with data on each firearm — such as type, model, caliber, serial number and names and addresses of both the supplier and the buyer. The data would be kept for at least 20 years.

The name of manufacturer, place and year of fabrication and serial number must be marked on every firearm. Individual collectors or historical collection of arms will be exempt from the new guidelines, an update to 1991 rules.

The measures, which need formal approval from all 27 EU government, are expected to go into force by January. EU member states would then have two years to adopt and fully implement them.

The legislation has been 18 months in the making but parliamentarians said they saw a pressing need to pass the new rules to prevent such massacres as the Finnish shooting.

"A 100-percent risk-free environment can never be created. But we can try to prevent events such as those in Finland or Germany," said Gisela Kallenbach, a Green party deputy from Germany.

Germany, which has had five deadly school shootings in the past seven years, raised the age for owning recreational firearms from 18 to 21 after a 2002 massacre in Erfurt in which a 19-year-old killed 13 teachers, two former classmates and a policeman before committing suicide.

The new rules bring the EU into line with a U.N. protocol on firearms and harmonizes the different gun control measures across the bloc. Countries with more stringent gun controls will be allowed to keep them.

In Finland, for example, 15-year-olds are allowed hunting rifle permits, and there are 1.6 million registered guns for a population of 5.3 million. In Britain, 17-year-olds may buy a shotgun if they have a gun certificate.

"Guns are not something young people should be getting hold of. ... Recent dramatic events have shown just how necessary it is to have better control of the purchase and circulation of arms," said European Commission Vice President Guenter Verheugen of Germany.