Brussels (AFP) - The EU and Canada finally signed a landmark free trade deal seven years in the making on Sunday, after overcoming last-minute resistance from a small Belgian region that nearly torpedoed the entire agreement.

Canadian Prime Minister Justin Trudeau flew to Brussels for a ceremony that had been pushed back from Thursday after Wallonia with its population of 3.6 million initially vetoed a pact affecting more than 500 million people.

But in a sign of the fierce passions aroused by the giant Comprehensive Economic and Trade Agreement (CETA), protesters burst through riot police lines and hurled red paint at the EU's headquarters.

"That I be here today or three days ago is not going to make a huge difference in the grand scheme of the real impact it's going to have for this good deal to move forward," Trudeau said after signing the pact with leaders of the EU institutions.

Cheers and applause erupted as they inked a long-anticipated deal that will remove 99 percent of customs duties between the two sides, linking the single EU market of 28 nations with the world's 10th largest economy.

- 'Disintegration of West' -

The leaders hailed the pact as good news after the Belgian drama, which sparked dire warnings for the EU's credibility as it wrestles with Britain's shock vote to leave, a huge migration crisis and the threat of a resurgent Russia.

The signing was also further delayed when Trudeau's plane from Canada suffered "mechanical issues" and had to turn back for repairs.

"Patience is a tree whose root is bitter, but its fruit is very sweet," EU President Donald Tusk said. "Today's decisions demonstrate that the disintegration of the Western community does not need to become a lasting trend."

European Commission chief Jean-Claude Juncker meanwhile said the deal was an "international standard that will have to be followed by others" -- not least an even bigger agreement that the EU is negotiating with the United States.

Story continues

But the fate of the Canada-EU deal -- so close to the finish line after seven gruelling years of negotiations -- had been hanging by a thread until just days ago because of Belgium.

French-speaking Wallonia had for two weeks resisted huge pressure to back the deal until it won concessions for regional farming interests and guarantees that international investors will not be able to force governments to change laws.

Following marathon talks led by Belgian Prime Minister Charles Michel, the Walloons finally agreed on Thursday evening, and a day later, Trudeau agreed to fly in for the delayed signing.

The pact required all EU member states to endorse it and in some cases such as Belgium's for regional governments to agree too, giving tiny Wallonia an effective veto.

- 'Trojan horse' -

Concerns in the declining industrialised region in Belgium's south reflect wider worries in Europe about globalisation, as well as fears among activists that such deals erode consumer, social and environmental protections.

On Sunday, around 100 protesters banged drums and shouted slogans outside the European Council building while Belgian riot police backed by water cannon looked on, AFP reporters said.

The glass front doors of the building were also daubed with red paint after some protesters briefly managed to break through police lines, with a number of them arrested.

The activists also see CETA as a Trojan horse for the even larger -- and more controversial -- deal between the EU and the United States.

Negotiations for that deal, known as the Transatlantic Trade and Investment Partnership (TTIP), have however stalled in recent weeks, and the goal of approving it by the end of President Barack Obama's term in office now having been abandoned.

The troubles with the Canadian deal have meanwhile been seen as a possible harbinger of things to come for Britain as it tries to negotiate a new trade pact with the EU after it leaves the bloc -- most likely in 2019.