Europe is proposing new gun control laws in response to recent terror attacks and mass shootings.

The European Union has agreed to ban sales of the most dangerous semi-automatic firearms, and to make it much harder to legally buy other weapons in the EU.

People across the EU will now have to go through medical checks before getting a license to buy firearms. Online sales will also be limited.

Jean-Claude Juncker, the head of the European Commission, called the agreement a "milestone in gun control in the EU."

"We have fought hard for an ambitious deal that reduces the risk of shootings in schools, summer camps or terrorist attacks with legally held firearms," he said.

Related: Gun sales on track to set a record

The EU will also make it easier to track legally bought firearms in order to prevent them from being re-sold on the black market.

States across the EU will also start sharing more information about firearm sales to make sure that a person who fails checks in one member state cannot buy guns elsewhere in the European Union.

Gun ownership is lower in the European Union compared to the U.S. According to official statistics, only one in ten European citizens, or 10%, own or have previously owned a firearm. But according to a 2015 Gallup research, 41% of Americans have a gun in their home, while 28% own one personally.

The top three European institutions -- the Commission, the Parliament and the Council -- finally reached a political agreement on the new rules on Tuesday, after more than a year of difficult negotiations.

The European Commission, Europe's top regulator, was pushing for even stricter rules, including a complete ban on semi-automatic weapons.

However, some member states opposed that approach. Finland said such ban would affect its national defense, which relies on reservists being able to train with semi-automatic weapons.

The Czech Republic and Sweden also protested, saying the ban would hurt those who use firearms legally for sport or hunting.

Luxembourg, on the other hand, was arguing for even stricter rules.

Related: Why gun stocks are plunging since Trump won

Firearms United, one of the biggest gun lobby groups in Europe, was campaigning against the new rules. It organized a petition against the proposal, which gathered over 330,000 signatures.

The group argued that "restricting legal gun ownership will not stop terrorism." It said that recent terrorist attacks, including the mass shooting in Paris last November, were committed using unregistered black market weapons.

Automatic weapons had already been banned in the EU, but the new rules expand the ban to include more versions of semi-automatic weapons.

The new rules will still need to be formally agreed upon by the three European institutions before becoming law next year.