London: British Prime Minister Theresa May narrowly won a confidence vote in parliament winning approval for the government program outlined last week by Queen Elizabeth II.

The narrow result on Thursday — 323 votes to 309 — showed that support from the Democratic Union Party of Northern Ireland (DUP) had been crucial in the voting. It was the first major test for May since this month’s snap general election when she lost her overall majority.

The Conservatives have 318 Members of Parliament (MPs) in the House of Commons, eight short of what is needed for a guaranteed majority, Xinhua news agency reported.

To prop up her minority government, May struck a deal with the DUP and its 10 MPs at Westminster, but at a price. She had to agreed to a funding package worth a billion pounds for projects in Northern Ireland.

Earlier in a day, the main opposition Labour party made a number of attempts to test May’s power in the House of Commons, adding to a day of high tension at Westminster.

They put forward two amendments, but lost — one of them by just 26 votes.

May’s government had faced potential defeat in one amendment put forward by Labour MP Stella Creasy over access to abortions for women from Northern Ireland.

Creasy wanted MPs to vote on giving women from across the Irish Sea the right to abortions on the British mainland, funded by the National Health Service (NHS). Currently, women have to pay around $1,200 for an abortion.

Another amendment to the Queen’s Speech debate, by Labour MP Chuka Umunna, called for continued single market and customs union membership of the European Union after Brexit, but it was defeated by a vote of 322 votes to 101.

Later, it was revealed that a number of front bench opposition shadow ministers had backed Umunna, leading political commentators at Westminster to predict that around six people would be be fired by opposition leader Jeremy Corbyn.