Progressive Conservative Leader David Alward has conceded defeat in the New Brunswick election and is stepping down from the party after a long night and a fiasco involving voting machines.

Liberal Leader Brian Gallant won 27 seats compared to 21 for Mr. Alward and the Tories. And for the first time in the province's history, voters elected a Green Party member as leader David Coon defeated a cabinet minister, winning a seat in Fredericton.

The Liberal election win, however, was overshadowed by questions around the counting of the ballots.

Story continues below advertisement

More than five hours after polls closed, Mr. Gallant, slated to become the youngest premier in New Brunswick history at the age of 32, spoke to a small gathering at his headquarters in Grand Digue, a small community on the Northumberland Strait.

The wait was so long that the Liberals had dismantled their headquarters – and then had to put up the podium and backdrop again for his victory speech.

"We need to bring hope back to New Brunswickers and need to focus on jobs and help families who are struggling," Mr. Gallant told his supporters.

He offered "special congratulations" to the Green Party Leader, calling Mr. Coon's victory "truly historic."

Mr. Gallant also noted that the Liberals won with a clear majority of seats.

Asked if a recount is needed, Mr. Gallant said the delay in vote counting doesn't "deny the results"and said he believed he has won a "convincing plurality" of votes.

Mr. Alward said while he was disappointed with the results of the election, he would like to see a review of the problems Elections New Brunswick had counting the ballots on Monday night.

Story continues below advertisement

"I believe Elections New Brunswick has an obligation to New Brunswickers to ensure that every ballot is counted properly and that there is a thorough review," Mr. Alward told a news conference in Fredericton, adding he will continue to represent the riding of Carleton in the legislature

Mr. Gallant's victory was the fourth straight Liberal election victory in the past year in Eastern Canada after wins by the party in Ontario, Quebec and Nova Scotia.

The party's recent fortunes might not bode well for Stephen Harper's Conservatives in the region in next year's federal election. In fact, during the New Brunswick campaign, the provincial Liberals lumped Mr. Alward's Tories in with the Harper Conservatives, saying both men had made a "mess" of the province's economy.

The Liberals won on a promise to rebuild the province's roads and bridges to create jobs, turfing the PCs after just one term in office.

The Tory defeat makes the 54-year-old Mr. Alward the second straight premier to fail in his bid for a second term, a rarity in New Brunswick politics.

Earlier in the evening, technical glitches caused vote counting to be suspended. The PCs called for all the ballots to be counted by hand to ensure the accuracy of the outcome.

Story continues below advertisement

Election results had ground to a halt while Elections New Brunswick investigated problems with its tabulation machines. It was using machines that digitally scan and read the results for the first time in a provincial election. Observers from other election authorities from across the country came to New Brunswick to watch the process. Results were promised by 9 p.m. – but more than 90 minutes later, results were either at a standstill or only trickling in.

Chief electoral officer Michael Quinn said Elections New Brunswick stopped sending results to its website at 10:30 p.m. AT when officials noticed discrepancies between some data. Nearly four hours after polls closed, Mr. Quinn was still waiting for the results from 35 memory cards from the tabulators, representing potentially thousands of votes.

The Liberals ran on a promise to spend $900-million on infrastructure as a way to stimulate the economy and create jobs. The Progressive Conservatives campaigned to make fracking the centrepiece for job creation in the struggling province.

Meanwhile, Mr. Coon made history for the Green Party. Like federal Green Leader Elizabeth May, who beat a sitting cabinet minister in the 2011 election, Mr. Coon was dogged in his campaigning to defeat Energy Minister Craig Leonard, whose job it was to push fracking in the province.

NDP Leader Dominic Cardy, meanwhile, failed to win his Fredericton-area seat and has resigned.

"My message to my party that I love, and my province which I love, is that it's much better to reach your arms out wide and to fall and to stand up again than it is never to dream at all," Mr. Cardy said to throngs of supporters.

Story continues below advertisement

The NDP has been shut out of the legislature since then-leader Elizabeth Weir resigned in 2005.

The 32-day campaign gave New Brunswickers a clear choice on where they wanted to take their province.

New Brunswick is economically challenged – facing a $391-million deficit for the 2014-15 fiscal year and a $12.2-billion debt.

Mr. Alward tried to make the election into a referendum on hydraulic fracturing – or fracking. He vowed that extracting shale gas was New Brunswick's only hope of becoming a "have" province, creating jobs and keeping the young people, who have fled the province for jobs out west, at home.

His campaign slogan was "Say Yes" to fracking, jobs and prosperity – and another Tory mandate. He forecast that the province would see $10-billion in private investment in the energy sector through the government's promotion of natural resource development, including shale gas and the proposed Energy East pipeline.

Mr. Gallant, however, presented a different vision. Borrowing from Kathleen Wynne's successful campaign in Ontario this spring, Mr. Gallant promised to spend $900-million over six years on infrastructure. He said that would create 1,700 jobs a year.

Story continues below advertisement

The campaign started with polls showing the Liberals would cruise to victory – but as election day neared, the race tightened.

Mr. Gallant's youthfulness and lack of experience was played up by the Tories – and the mistakes he made in interviews, especially one he gave to the CBC, in which he mixed up his tax plan, that was particularly embarrassing. It played into the narrative that he wasn't ready for prime-time.

That storyline is the same one being used by the federal Conservatives on Liberal Leader Justin Trudeau as they try to define him in advance of next year's election.

With files from The Canadian Press