VICTORIA - The NDP will form a minority government in British Columbia after the Liberals were defeated Thursday in a non-confidence vote in the legislature, sending them to the Opposition benches for the first time in 16 years.

Premier-designate John Horgan emerged from a meeting with Lt.-Gov. Judith Guichon to say he was asked to form a government after reaching a deal with the Green party on a legislative agenda.

Horgan, 57, had a wide smile on his face, his supporters erupting into cheers as he announced he believes he can command the confidence of the house.

It's been more than seven weeks since the provincial election and asked about the moment, he said: "It's been a roller coaster."

Horgan said Guichon wanted assurances that the continuity of the legislature will continue.

"I assured her I would do my level best to make sure that continuity continues," he said.

Horgan said his first priorities will be helping the softwood industry after the U.S. slapped punitive tariffs on lumber, the opioid overdose crisis and boosting resources for the education system before the start of the next school year to comply with a Supreme Court of Canada ruling.

"We want to make sure that the services people count on are there for them when they need it," he said. "We want to make sure, most importantly, that we continue to grow as a dynamic, diverse province, the envy of Canada."

He couldn't say precisely when the NDP will be able to swear-in a cabinet and begin the task of governing, but indicated he wants to act quickly.

His fledgling government faces hurdles because even with the support of the three Green members of the legislature, the NDP can only count on 44 votes in the 87-seat assembly, putting them in a precarious position.

No members of the legislature broke ranks in the confidence vote as the Greens backed the NDP to defeat Christy Clark's government.

The Liberals lost the vote 44-42.

Guichon issued a short statement to say she had accepted Clark's resignation.

"I have asked Mr. Horgan to form a government, he having assured me that he can form a government which will have the confidence of the legislative assembly," it said.

Clark congratulated Horgan and Green Leader Andrew Weaver and reflected on her time as premier.

"I am so grateful for the job, to be able to do this for six years," she said, adding Horgan is inheriting a strong economy and fiscal situation.

Clark said she asked Guichon to dissolve the legislature to allow for an election because of her concerns over how the house will operate, but her request was denied.

"I certainly accept that result," she added.

Earlier, Clark made a last-minute plea to members of the legislature to support her government, saying voters in May's election sent a message that they want the three parties to work together.

In a bid to remain in power, the Liberals adopted NDP and Green promises from last month's election in their throne speech including higher social assistance rates, banning corporate, union and third-party donations to political parties, spending more on childcare and increasing the carbon tax.

"When we go into political combat we all acknowledge that sometimes we spend so much time fighting with one another in here that it's hard to listen to what British Columbians want. And the throne speech is an answer to that," she said.

"It's an answer to what voters told us on May 9. It's an acknowledgment, a sincere acknowledgment, that we didn't get it right. It is an expression of renewed priorities based on what voters told us, including that they want us to work across party lines with one another."

But the opposition parties signalled from the outset they had no intention of backing the Liberals, defeating two measures they had supported during the election.

The work of government has been in limbo for almost two months since the Liberals won a minority government with 43 members.

Because the Speaker doesn't typically cast a vote, the New Democrats and Greens wanted Liberal Steve Thomson to remain in the chair, but he resigned shortly after the non-confidence motion passed. Settling who serves as Speaker will be a key decision when the legislature returns.

Clark said earlier this week the legislature can't work if the NDP is in power because the election results were so tight.

Her comments prompted ridicule and heated exchanges in the house on Thursday, with accusations the Liberals were clinging to power.

Clark suggested Weaver lied when he told voters he would work with all politicians in the legislature.

"He wasn't telling the truth about that then and he isn't telling the truth about what he is saying today," Clark said, later withdrawing the accusation after the Speaker intervened.

Weaver said it was time for the Liberals to move to the opposition benches.

"They are acting like belligerent children as they're going into that time out."