The Liberals have won a majority government in New Brunswick, after a long night of vote-counting that was held up for two hours because of a glitch in a new election system.

The count: Liberals were elected in 27 ridings; the Progressive Conservativeswill take 21 seats in the new legislature.

Liberal Leader Brian Gallant, 32, who is slated to become Canada’s youngest premier, delivered his victory speech in the early hours of Tuesday morning.

"The count has been delayed, but not denied," Gallant told his supporters. "We have a won a convincing victory in the popular vote."

He said his party will ensure that the province moves “in the right direction.” He promised jobs and prosperity for New Brunswick residents.

Elections New Brunswick made an announcement about the vote count glitch at 10:45 p.m. local time, almost three hours after the polls closed in the tight election, and counting was paused for almost two hours.

They were investigating issues with the electronic tabulating system, which was being used for the first time in the provincial election. Later, it was determined that some of the results being entered manually were not being replaced properly by subsequent results coming in from memory cards.

Mike Quinn, the chief returning officer for Elections NB, told CTV Atlantic’s Steve Murphy that the poll results were originally being phoned in by local returning officers. That phoned-in information is then manually entered into the system and posted to the website.

Later, the electronic results were supposed to override the manual entries as they come in.

“We did notice that in some cases the memory cards was at slight discrepancy with what we’d got from the returning office,” Quinn said.

“And now we’ve begun the process of re-uploading all the memory cards to the web, and we trust those numbers because they are good numbers.”

In other major developments:

  • The Green Party won its first seat in the legislature, with leader David Coon taking the riding of Fredericton South.
  • NDP Leader Dominic Cardy announced his resignation after the party failed to win any seats. The party last won a seat in the 2003 election.

The legislature has 49 seats. Twenty-five seats are required for a majority government.

Progressive Conservative Leader David Alward, who has been premier since 2010, won re-election in his own riding. He had campaigned on a platform of job creation through development of natural resources, including forestry and shale gas.