Canadian voters emphatically reclaimed their country's liberal identity, putting Justin Trudeau, the youthful son of one of the country's most dynamic politicians, in the prime minister's office, and ending 10 years of leadership by Stephen Harper, whose dream was to recast Canada as a more conservative country.

The victory in Monday's election by Trudeau's Liberal Party was stunning. The Liberals were on a path to win at least 184 seats out of 338 - a parliamentary majority that will allow Trudeau to govern without relying on other parties. Harper's Conservatives were winning 100. The Liberals received 39.5 percent of the overall vote compared to 32 percent for the Conservatives and 19.6 for the New Democrats.   

Harper, one of the longest-serving Western leaders, will step down as Conservative leader, the party announced as the scope of its loss became apparent.

Trudeau's victory could result in improved ties with the United States, at least for the remainder of Barack Obama's presidency. Harper was frustrated by Obama's reluctance to approve the Keystone XL pipeline from Alberta to Texas and clashed with the president on other issues, including the Iran nuclear deal. Although Trudeau supports the Keystone pipeline, he argues relations should not hinge on the project.

Trudeau is the son of the late Prime Minister Pierre Trudeau, who swept to office in 1968 on a wave of support dubbed "Trudeaumania."  He was prime minister until 1984 with a short interruption and remains one of the few Canadian politicians known in America, his charisma often drawing comparisons to John F. Kennedy.

Trudeau channels the star power — if not quite the political heft — of his father. Tall and trim, he is a former school teacher and member of Parliament since 2008.  At 43, he becomes the second youngest prime minister in Canadian history and has been likened to Obama.

"Tonight Canada is becoming the country it was before," Trudeau told a victory rally in Montreal.

Trudeau has re-energized the Liberal Party since its worst electoral defeat four years ago when they won just 34 seats and finished third behind the traditionally weaker New Democrat Party. Trudeau promises to raise taxes on the rich and run deficits for three years to boost government spending. He said positive politics led to his victory.

"We beat fear with hope," Trudeau said. "We beat cynicism with hard work. We beat negative, divisive politics with a positive vision that brings Canadians together. Most of all we defeated the idea that Canadians should be satisfied with less."

Harper, one of the longest-serving Western leaders, stepped down as the head of the Conservatives, the party said in a statement issued as the scope of the loss became apparent.

Canada has shifted to the center-right under Harper, who has lowered sales and corporate taxes, avoided climate change legislation and clashed with the Obama administration over the Keystone XL pipeline.

"The people are never wrong," Harper told supporters in Calgary. "The disappointment is my responsibility and mine alone."

Harper said he had called Trudeau to congratulate him.

Trudeau's opponents pilloried him as too inexperienced, but Trudeau embraced his boyish image on Election Day. Sporting jeans and a varsity letter jacket, he posed for a photo standing on the thighs of two his colleagues to make a cheerleading pyramid, his campaign plane in the backdrop with "Trudeau 2015" painted in large red letters.

"A sea of change here. We are used to high tides in Atlantic Canada. This is not what we hoped for," said Peter MacKay, a former senior Conservative cabinet minister, shortly after polls closed in Atlantic Canada.

Harper, 56, visited districts he won in the 2011 election in an attempt to hang onto them. On Saturday, he posed with Toronto's former crack-smoking mayor, Rob Ford, in a conservative suburb.

Former colleagues of Harper said he would be personally devastated to lose to a Trudeau, the liberal legacy he entered politics to destroy. Harper's long-term goal was to kill the widely entrenched notion that the Liberals — the party of Pierre Trudeau and Jean Chretien — are the natural party of government in Canada, and to redefine what it means to be Canadian.

Hurt when Canada entered a mild recession earlier this year, Harper made a controversy over the Islamic face veil a focus of his campaign, a decision his opponents seized on to depict him as a divisive leader.

"Canadians rejected the politics of fear and division," New Democrat leader Tom Mulcair said of Harper's Conservatives.

Nelson Wiseman, a political science professor at the University of Toronto, said Canadians rallied around the Liberals as the anti-Harper vote.

"It became not only a referendum on Mr. Harper but really a sweep for Mr. Trudeau as well," said Antonia Maioni, a political science professor at McGill University.

"A clash of values pushed Canadians to really think about what they wanted from a government and what kind of image they wanted reflected back from that government and I think that's where Mr. Trudeau's optimism and hope and idea of change captured people's imagination."

The New Democrats suffered a crushing defeat, falling to third place with 43 seats after winning official opposition status in the last election.

"I congratulated Mr. Trudeau on his exceptional achievement," Mulcair said at a rally in Montreal.

Paula Mcelhinney, 52, from Toronto, voted Liberal to get rid of Harper.

"I want to get him out, it's about time we have a new leader. It's time for a change," she said.

___

Associated Press writer Charmaine Noronha contributed to this report.