Greg Selinger has resigned as leader of the NDP, as the party's nearly 17-year stretch in government came to an end Tuesday night.

"In a democracy, friends, the people are always right, the collective wisdom of Manitobans has to be respected," he told a crowd of supporters at the RBC Convention Centre. "Tonight as we examine the results ... I have offered my resignation."​

Selinger said his resignation takes effect immediately and he has asked the party to appoint an interim leader. The party lost on the night, but Selinger was re-elected as MLA for St. Boniface — a position he has held since 1999.

Selinger won St. Boniface by more than 1,000 votes (over 41 per cent of the vote), compared to his next closest competitor in PC candidate Mamadou Ka.

LIVE ELECTION RESULTS: PC majority government in Manitoba, CBC News projects

The NDP haven't held fewer than 32 seats in the Legislative Assembly of Manitoba since 1999. The New Democrats were elected in 14 constituencies on Tuesday, compared to the Tories' 40 and three for the Liberals.

Greg Selinger announces his resignation as leader of the NDP Tuesday at the RBC Convention Centre in Winnipeg. The NDP lost to Brian Pallister and the Progressive Conservatives. (CBC) The New Democrats' attempt to secure an unprecedented fifth term in government was foiled by Brian Pallister and the PCs, whose months-long surge in opinion polls foreshadowed the results on election day.

Early on, the PC campaign targeted Selinger as an untrustworthy leader with a record of "broken promises," referring to the provincial sales tax hike in 2013. Selinger increased the PST from seven to eight per cent that year after publicly stating in 2011 that he wouldn't.

"On the eve of the [2011] election, [Selinger] was at 52 per cent approval rating," political scientist Paul Thomas said the day before results were in. "Now he's in the low teens."

Pallister pointed at turmoil within the NDP in the aftermath of the tax hike, including the party's 2015 leadership race, as indicators the NDP is divided and unfit to govern under Selinger.

Struggled in polls

The NDP struggled to stem the PCs' commanding lead in the polls, trailing by 20 points or more in recent months. They used tactics in the final weeks that the Tories repeatedly characterized as desperate "American-style politics."

Selinger frequently portrayed Pallister as a socially conservative ideologue, saying the PC leader had plans to privatize Manitoba Hydro and parts of the health-care system, cut budgets and introduce austerity measures that would leave Manitobans "out in the cold."

Manitoba NDP Leader Greg Selinger votes in the provincial election in Winnipeg, Tuesday, April 19, 2016. (Canadian Press/John Woods) In the two weeks before election day, Selinger called Pallister homophobic , accused him of misleading Manitobans about his personal finances and assets abroad, and suggested the PC leader's failure to rule out privatization indicated he would bring in a two-tiered health-care system in Manitoba.

The NDP's final privatization accusation came four days before the election, when Selinger suggested a Pallister-led government would start charging Manitobans for cancer-fighting drugs — a move PC candidate Heather Stefanson shot down, describing it as a disgusting example of political theatre designed to scare people with cancer into voting NDP.

On April 10, Selinger showed reporters details from his 2014 tax return while sitting at his kitchen table, saying as a politician and leader who values transparency, the Panama Papers scandal motivated him to be open about his finances. He challenged the opposition to do the same. Bokhari complied in part, showing some of her 2013 return; Pallister refused, calling it a desperate "last-minute election stunt," but disclosed he owns a vacation home in Costa Rica and a bank account.

The NDP questioned Pallister over how much time he spends at his vacation property in Costa Rica (240 days since being elected leader of the PCs in 2012).

Despite the pro-PC figures reflected in the polls, political scientist Royce Koop told the Canadian Press over the weekend Selinger's "unpopularity" would be "far more important to understanding the outcome than Mr. Pallister's popularity."

The long road to becoming premier

Greg Selinger was born in Regina in 1951. When he was five, he, his brother and their single mother moved to St. James in Winnipeg after his parents' marriage ended.

Selinger worked a series of odd jobs during his youth before heading to the University of Manitoba, where he completed a degree in social work. He graduated with a master's in public administration from Queen's University and a PhD in social policy from the London School of Economics, before returning to the U of M as an associate professor in the faculty of social work.

Selinger's first foray into politics was at the municipal level in Winnipeg. Selinger was elected in 1989 to represent St. Boniface on city council, and in 1992 he lost a mayoral bid to Susan Thompson.

He entered the provincial arena in 1999, when he was elected MLA for St. Boniface — a position he has held since — and named minister of finance under Gary Doer. He was appointed to several other files over the years, and in 2009, he ran a successful bid to become leader of the NDP. He became Manitoba's 21st premier in October 2009.

Selinger is married, has two sons and lives in Old St. Boniface.

For CBC's full coverage of the provincial election, see Manitoba Votes 2016.