British prime minister David Cameron, fresh from winning the most extraordinary House of Commons victory in modern times, has insisted that he will hold a referendum on the UK’s European Union membership within two years.

Mr Cameron, who now commands 331 seats in the Commons, may seek to reach some accommodation with the Democratic Unionist Party and the Ulster Unionists to buttress his majority over the next five years.

The scale of his victory, which defied opinion poll predictions, has caused concern across the EU, given the challenge of difficulty in appeasing London’s demands for reforms without provoking demands from every state.

The Taoiseach this morning spoke to British Prime Minister David Cameron and warmly congratulated him on his re-election.

Last night, Mr Cameron reappointed as foreign secretary Philip Hammond, who has made some efforts over the last months to build ties with other EU capitals.

Chancellor of the exchequer George Osborne’s position has been strengthened. He remains in that post but in effect becomes deputy prime minister as first secretary of state, while Theresa May and Michael Fallon stay as home secretary and defence secretary.

However, the new Cabinet could have a distinctly more Eurosceptic tone with promotions predicted on Monday for ministers Priti Patel and Andrea Leadsom, as well as the chairman of the influential 1922 Committee of backbenchers, Graham Brady.

In addition, former defence secretary Liam Fox could make a return nearly four years after he had to resign over the actions of one of his staff, while Dominic Raab, a long-standing opponent of EU membership, is also tipped for promotion.

Congratulating Mr Cameron, European Commission president Jean-Claude Juncker held out an olive branch: “I stand ready to work with you to strike a fair deal for the UK in the EU.”

Taoiseach Enda Kenny made no specific mention of the EU, but said he hoped to continue working with the Britishprime minister on “the full range of issues of common interest to the UK and Ireland”.

Mr Cameron has declared his preference to stay in the EU, though it is unclear how much political capital he is prepared to expend on the issue, given that nearly two-thirds of his party’s grassroots’ membership wants to quit the union.

Following a dramatic night at count centres, the Conservatives emerged with 331 seats, up 24; Labour with 232, down 26; the SNP with 56, up 50 and the Liberal Democrats with 8, down 49 seats. The UK Independence Party disappointed, losing one of its two existing MPs.

The results prompted speedy resignations over a couple of hours of the Labour leader, Ed Miliband, the Liberal Democrats’ Nick Clegg and Ukip’s Nigel Farage – though the latter left open the possibility that he could back within months.

Close to tears, Mr Clegg said “the politics of fear and grievance” – a criticism of much of the Conservatives’ campaign, but also that of the SNP – had won while liberalism had lost, adding that he had always feared his party was set for heavy losses.

“But clearly results have been immeasurably more crushing and unkind than I could ever have feared. For that, of course, I must take responsibility and therefore I announce I will be resigning as leader,” he said.

In a pointed message to Mr Cameron, however, Mr Clegg said: “It’s no exaggeration to say that in the absence of strong and statesmanlike leadership Britain’s place in Europe and the world and the continued existence of our United Kingdom itself is now in grave jeopardy”.

Mr Cameron’s success in securing an unexpected overall majority meant that the DUP and first minister Peter Robinson’s hope that it would be “kingmaker” in dictating who is the next British prime minister was not realised.

Nonetheless, Mr Robinson could still yield important influence at Westminster as Mr Cameron is relying on a very slim majority of just 8 seats when the position of the Speaker and the fact that Sinn Féin won’t take up its seats are taken into account.

The 8 seats of the DUP plus the two seats won by the Ulster Unionist Party could be important in shoring up support for Mr Cameron during the lifetime of parliament. Mr Robinson is due in London today for Victory in Europe celebrations which could permit some direct contact between him and Downing Street.

The big surprise in the North was the minor resurgence of Ulster Unionist Party which won two seats after holding no seats in the House of Commons. In South Antrim UUP candidate Danny Kinahan unseated the DUP’s, the Rev William McCrea, while a bigger upset was former UUP leader Tom Elliott defeating outgoing MP Michelle Gildernew in Fermanagh South Tyrone, reducing Sinn Fein’s Westminster strength from five to four.

In East Belfast the combined DUP-UUP pact ensured that Gavin Robinson took back the seat that Alliance’s Naomi Long sensationally won from Peter Robinson in 2010. The SDLP held its three seats.

Meanwhile, the Scottish National Party has insisted that it will press to hold a second independence referendum in Scotland if voters across the UK voted to quit the EU — a view shared in Wales and Northern Ireland, too.

Scotland’s voice will not be ignored, said the former SNP leader, Alex Salmond, who now returns to the Commons more than a decade after he last left it, even though the SNP’s votes are not needed to form an administration.

“The Scottish lion has roared this morning across the country. It is inconceivable that such a statement of unity by the people of Scotland could be ignored,” declared Mr Salmond, shortly after he had comprehensively won his seat.