PARIS — More than 20,000 people, most of them Canadians, attended a solemn ceremony Sunday to commemorate a World War I battle in northern France that remains indelibly etched on Canada’s national identity 100 years after it happened.

Prime Minister Justin Trudeau and members of the British royal family were among the dignitaries who gathered at Vimy Ridge for the centenary of the day that outnumbered Canadian troops succeeded in taking the strategic position from the Germans.

“They were, most of them, young men in their late teens, in their early 20s,” Trudeau said at the ceremony. “Going as far as sacrificing their lives, these men both ordinary and extraordinary of the British dominion fought for the first time as citizens of a single and same country … side by side here in Vimy.”

Canada lost 3,600 soldiers and over 7,000 were wounded during the three-day battle. Largely because of its military achievement in northern France, Canada was a separate signatory to the treaty that ended World War I.

“In this sense, Canada was born there,” Trudeau said.

It was first action in which all four divisions of the Canadian Corps – representing every region of the country – fought together side by side on the same battlefield. The troops prepared carefully, learning from the mistakes made by British and French troops that had tried and failed to reclaim the ridge.

To protect soldiers from shelling, they built miles of tunnels, one of the war’s great engineering feats allowing troops to pop up quickly into their positions. The Germans would never regain the ridge.

The battle and victory have become an important part of Canada’s identity, symbolizing the shift from a former British colony to an independent nation. The site, which in 1922 became a piece of Canadian territory on French soil, is a revered national symbol, featured on the back of Canada’s $20 bill to this day.

Britain’s Prince Charles attended the commemoration with his sons, Princes William and Harry, who dropped boots symbolizing the dead soldiers and ceramic poppies at the grand war memorial that marks the site of the battle.

“Their sacrifice must inspire us to do everything to avoid that senseless losses happen again,” Charles said of the long-ago Canadians who lost their lives in France. “Let’s renew our commitment to remember their heroism in the face of suffering and fear.”

French President Francois Hollande said Vimy’s soldiers “are still speaking to us.”

“They are telling us peace is the most precious gift and it’s the greatest merit of Europe to have realized that dream … Yes, Vimy’s soldiers are telling us nationalism only leads to war and fundamentalism to destruction. They are telling us the future of our countries is to be united.”

Sunday’s ceremony, hosted by the Canadian government, included official speeches, recitations of stories from soldiers and eyewitnesses to the battle, and performances by Canadian artists such as singer Loreena McKennitt.

Earlier Sunday, Trudeau and Hollande unveiled a separate “Poppy of Peace” monument in the town of Arras, a few miles from Vimy. The monument consists of a red metallic base with sculptures of soldiers’ feet.

Canada’s victory at Vimy became a nation-building moment for English Canada at a time when the young country was still attached to Britain. It emboldened Canada and its soldiers, who became significant contributors to ending the war in subsequent battles.

On Monday, Trudeau will visit World War II sites in the Normandy region. He will go to Juno Beach, where the Canadian landing took place in Normandy, and visit the Canadian War Cemetery in Beny-sur-Mer.