Prime Minister Stephen Harper praised the "iron will" of Allied troops that landed on the beaches of Normandy on June 6, 1944 during a speech Saturday at a service in France to commemorate the 65th anniversary of D-Day.

Harper said that freedom, democracy, human rights and the rule of law are the principles that the Allies fought and died for on D-Day.

"Never dismiss these things as mere abstractions. They are the very foundation upon which our lives of peace and prosperity are built," he said as he addressed hundreds of veterans on the beach.

"It is only when these values are in peril, when we have to defend them, that we can truly understand their worth as our soldiers did."

Harper sat in the front row with U.S. President Barack Obama, French President Nicolas Sarkozy, British Prime Minister Gordon Brown and Prince Charles.

After a military band and choir sang their countries' national anthems, Sarkozy stood up and thanked the soldiers of each nation for liberating France from Nazi control.

After Sarkozy spoke, Harper told the thousands of veterans and dignitaries attending the ceremony that they were standing on hallowed ground.

"The iron will of those troops, the careful planning of their commanders and the unwavering support of their fellow citizens back home resulted in victory that day and in the eventual triumph of good over evil in the months that followed," Harper said. "This was the most spectacular achievement of what has famously and rightly been described as the greatest generation."

When it was his turn to speak, Obama recalled the "unimaginable hell" that soldiers endured during the invasion, which was successful despite poor weather and constant fire from waiting Nazi troops.

"The sheer improbability of this victory is part of what makes D-Day so memorable," Obama said.

"Friends and veterans, what we cannot forget -- what we must not forget -- is that D-Day was a time and a place where the bravery and selflessness of a few was able to change the course of an entire century," he added later.

The leaders then laid a wreath honouring the fallen soldiers as the sound of Taps filled the air, a solemn moment followed by a flyover by the American, British and French air forces.

Harper's visit wasn't planned until the last minute because Ottawa had been waiting for an official invitation from the French, Canadian government officials said Saturday.

A French presidential official confirmed Friday that Sarkozy initially wanted the ceremony to be limited to Obama and himself.

But both Canada and Britain insisted on being included.

Prior to the afternoon ceremony, Harper began the day by laying a wreath at the grave of the unknown soldier at the Canadian war cemetery in Beny-Sur-Mer.

At an event later in the morning, Harper praised the thousands of Canadian soldiers who took part in the Allied invasion of Juno Beach, saying they undertook "the most dangerous task imaginable," and laid the groundwork for the peace that Europe enjoys today.

"We should always remember that, acknowledge that and be prepared ourselves to defend those things and those values in the future," Harper said.

More than 14,000 soldiers of the 3rd Canadian Infantry Division charged on shore at Juno Beach with their Allied comrades on June 6, 1944.

Canadian soldiers took the port of Courseulles-Sur-Mer, France, as well as two smaller villages in the east. By nightfall on June 6, the Canadians had moved further inland than either the Americans or the British.

The capture of Normandy eventually allowed the Allies to free France from the Nazis and was key for the Allied victory in World War II, but came at a high cost.

More than 200,000 Allied soldiers were killed or wounded on D-Day and the following three months needed to capture Normandy.

Historian and author Margaret MacMillan said that by 1944, most of Europe was controlled by the Nazis and their allies, and so D-Day marked an important opportunity to get a foothold on the continent.

"If the allies had failed to land on the continent of Europe after D-Day, and it really wasn't clear if they were going to succeed for a number of days, indeed weeks after those initial landings, then the whole history of Europe, and indeed the word, would have been different," MacMillan said Saturday during a telephone interview with CTV News Channel. "We might really have been under threat, much more than we fear today."

On Saturday evening, Harper attended an event honouring Canadian veterans at the Juno Beach Centre, where he hailed the Normandy invasion as an event that turned the tide of a "bitter and bloody" war.

"Most of us can only image what was going through their minds as the landing craft carried them toward the beaches," Harper said. "Apprehension, anticipation, thoughts of loved ones back home, and the profound conviction that what they were doing was right and just."

Canada marks D-Day

In Canada, ceremonies in Toronto and Ottawa commemorated the anniversary of D-Day and the Battle of Normandy.

Rows of veterans stood at the National War Memorial in Ottawa as the ceremony began with the national anthem and a moment of silence.

Under a light blue sky, those in attendance listened to veterans and dignitaries commemorate those who served in the battle.

Two young cadets recited a commitment to remember the bravery of those who fought to defeat fascism before dignitaries began laying wreaths.

Minister of Health Leona Aglukkaq laid a wreath at the memorial, and Chief of Defence Staff Gen. Walt Natynczyk laid one on behalf of Her Majesty's forces.

In Toronto, Premier Dalton McGuinty and Maj.-Gen Richard Rohmer joined with hundreds of veterans to remember Canadian soldiers who sacrificed their lives and the courage of the veterans.

"I want to thank our veterans for the leadership and courage they showed on D-Day," McGuinty said. "As citizens, we all have a duty to perform, too: to remember their stories and never forget the sacrifices they made for our freedom."

With files from The Associated Press and The Canadian Press