OTTAWA — The nine-year reign of Prime Minister Stephen Harper and his Conservative Party came to a sudden and stunning end on Monday night at the hands of Justin Trudeau, the young leader of the Liberal Party.

Starting with a sweep of the Atlantic provinces, the Liberals capitalized on what many Canadians saw as Mr. Harper’s heavy-handed style, and the party went on to capture 184 of the 338 seats in the next House of Commons. The unexpected rout occurred 47 years after Mr. Trudeau’s father, Pierre Elliott Trudeau, first swept to power.

Justin Trudeau, who will be 44 on Christmas Day, will become Canada’s second-youngest prime minister and the first to follow a parent into office.