President Trump congratulated Canadian Prime Minister Justin Trudeau early Tuesday on Trudeau's second-term win following parliamentary elections in Canada.

Trudeau, whose campaign was rocked by recent scandals, appeared set to win a second term and his Liberal party won the most seats in the 338-seat Parliament, giving it the best chance to form the next government.

"Congratulations to @JustinTrudeau on a wonderful and hard fought victory. Canada is well served. I look forward to working with you toward the betterment of both of our countries!" Trump tweeted after midnight Tuesday.

The CBC projected that the Liberals won't win the majority of seats in Parliament and will have to rely on another party to pass legislation. Not since 1935 has a first-term Canadian prime minister with a parliamentary majority lost a bid for re-election.

"It's way better than I expected. It was conceivable that the Liberals would lose," said Robert Bothwell, a professor of Canadian history and international relations at the University of Toronto. "Trudeau is going to have to command a caucus that will not be as grateful than it was in 2015. A lot of them will say `Look we won but not because of you."'

Trudeau had faced a string of controversies in the weeks ahead of the election, including a series of photos depicting the prime minister in blackface and brownface, for which he apologized. The 47-year-old was tarnished by a scandal that erupted earlier this year, when his former attorney general said he pressured her to halt the prosecution of a Quebec company. Trudeau has said he was standing up for jobs.

Trudeau reasserted the country's liberal identity in 2015 after almost 10 years of Conservative rule and has been viewed as a beacon of hope for liberals in the Trump era. The Liberal Party leader appeared on the cover of Rolling Stone magazine under the headline "Why Can't He Be Our President?" Read more at FOX News