Oxford and Cambridge universities are teaching nearly 1,000 fewer British undergraduates than they were five years ago, despite spending millions of pounds on programmes designed to widen participation and improve access for disadvantaged UK applicants.

Figures from the Higher Education Statistics Agency have shown that Oxford and Cambridge are almost alone among the competitive British universities in failing to expand their intake of domestic undergraduates while slowly increasing the proportion of sought-after places going to EU and international students.

But the two ancient universities defended their record, saying British applicants were far more likely to win admission as undergraduates than those from overseas, despite sharp increases in the numbers of applicants of all nationalities with the necessary grades.

Oxford said its undergraduate makeup was part of its mission to attract and educate the most talented students from across the world. “We are committed to our role in broadening participation in higher education and doing what it takes to make the university more open and diverse, and are making headway with this work,” a university spokesperson said. “Black and ethnic minority students now make up more than 18% of our undergraduate intake, while for the second year in a row more students than ever before have come to Oxford from deprived areas of the UK.”

A spokesperson for Cambridge said: “The university has made significant progress in all its widening participation measures over the same period. The university accepts students on merit, regardless of their background.”

Figures supplied by Oxford showed that UK applicants are far more likely to be offered a place compared with their EU and non-EU peers. Nearly one in four UK applicants – 23% - were made an offer, compared with one in 10 non-EU applicants and one in eight EU applicants.

But critics including the Sutton Trust and the Labour party argued that Oxbridge’s priority should be to educate talented UK applicants, given the huge number of qualified applicants the two universities attract domestically.

“Our world-class universities should be there for all of us, not just the wealthiest and privileged, and urgent action is clearly needed to ensure they are open to talented students regardless of their background,” said Angela Rayner, the shadow education secretary.

The figures for the 2017-18 academic year show that Cambridge had 12,155 first degree students , just 295 more than five years earlier. Of those, 9,365 were from the UK, 245 fewer than in 2012-13.

The combined number of EU and other international undergraduates taking first degrees at Cambridge in the same period rose by 545 to 2,790, with most of the increase coming from 420 additional international students, including many from China.

Oxford showed similar changes, with 420 more international students and 400 fewer British undergraduates in the same five years.

Figures first published by the BBC show that Cambridge has reduced the number of British undergraduates by 480 since 2007-08, while Oxford has reduced its intake by more than 700 in the same decade. In contrast, British universities such as Bristol and Exeter have increased their UK undergraduate numbers by more than 50%.

An indication of Oxbridge’s strong international standing came in the publication of the latest QS world university rankings by subject, which showed Oxford was the highest-performing British university by taking five of the top places.

Oxford was named the best university in the world for English language and literature, pharmacy and pharmacology, archaeology, anthropology and geography, while Cambridge took the No 1 spot for the study of anatomy and physiology.

Overall, the latest rankings were positive for British universities, which secured the top spot in 13 out of 48 subject areas this year, up from 10 last year.

University College London took the top spot for education and the study of architecture and the built environment; Sussex for development studies; the Royal College of Art for art and design; Loughborough for sports-related subjects; the Royal Veterinary College for veterinary science, and the London School of Economics for social policy and administration.

Ben Sowter, a director of research at QS, said: “The research data used to compile this edition was collected between 2013 and 2018, and the impact that our imminent exit from the EU will have on UK performance is still unknown.”

The US leads the QS rankings by a considerable margin, with the UK in second place, but QS says America’s higher education performance is faltering, with the number of top rankings at subject level down from 34 last year to 28 this year.

• This article was amended on 28 February 2019. An earlier version quoted figures for Cambridge of “12,155 first year students for first degrees”. The figures are for all students doing first degrees, not just those in their first year.