Edinburgh University has announced that it will charge non-Scottish UK students £36,000 for a degree.

The National Union of Students Scotland said the new £9,000 annual fee for all courses, with four-year degrees as standard, makes Edinburgh the most expensive university in Britain.

Heriot Watt and Aberdeen universities have also announced £9,000-a-year fees for non-Scots, but unlike Edinburgh they are capping fees at £27,000.

Edinburgh defended its decision by saying it would offset its fees with generous £6.7m-a-year bursaries for its non-Scottish undergraduates. It will be heavily funded by the higher fees, and be worth up to £7,000 a year per student. Professor Mary Bownes, the university's vice chancellor for external engagement, said: "The increase in the fee is necessary as we will no longer receive government funding for the rest of the UK domiciled students. These students will be studying at one of the world's top teaching and research institutions, regularly ranked amongst the leading universities in the world."

About 22,500 "rest of the UK" students go to Scottish universities each a year, currently paying £1,820 a year in fees, but the new fees were authorised by the Scottish government earlier this year.

Scottish university principals and Scottish ministers feared that there would be a surge in "fee refugees" heading north to avoid the £9,000 a year fees for English colleges authorised by the UK government.

Heriot Watt and Aberdeen have also announced new and enhanced bursaries for poorer students from outside Scotland to offset the new charges but the top-rate fees were denounced by the National Union of Students Scotland as "terrible news".

Referring to Edinburgh's decision, Graeme Kirkpatrick, the union's depute president, said: "A £36,000 degree is both staggering and ridiculous. The average cost to study at Oxford and Cambridge is around £25,000 in fees, which while still eye-wateringly large, pales in comparison with this. And that's before you add additional debt for the extra year of living costs for the four-year degree in Scotland.

"This is nothing less than cashing in on students from the rest of the UK, and giving the signal that Edinburgh University is more interested in the money you can bring, as opposed to your academic ability. The reputational damage this could do, not only to Edinburgh but to the whole of Scottish higher education, should not be underestimated.

"There's clearly a race to the top happening here in terms of setting fees. It's a depressing day when a university feels it's more likely to be judged on the price tag it chooses rather than the quality of the education it provides. Tuition fees put off the poorest students and make university more about your bank balance than your ability."

Most university courses in Scotland last four years, against three elsewhere in the UK, because many courses start with a general "foundation" year before students begin specialising fully.

That would have allowed Scottish colleges to set fees as high as £36,000 for a full four-year degree, much higher than their English counterparts, but Scottish universities believe most English students with strong A-level grades will be able to bypass the foundation year and begin their courses in second year.

Some students will face higher fees. Students doing medicine at Aberdeen and Edinburgh will still be charged £9,000 a year for the full five year course, as in England. Heriot Watt said students on "enhanced", five year courses in engineering, physics, chemistry and maths would be charged £9,000 for four years.

The Scottish universities argue the decision to cap fees for mainstream subjects at £27,000 will allow them to compete directly with English colleges. Professor Steve Chapman, the principle at Heriot Watt, defended the new fees, which will affect about 225 non-Scottish students there each year.

He said his university's degrees were "a positive investment in future employment. Over 92% of our graduates are in work or further study within six months of graduation, with approximately three quarters of those going straight into graduate level jobs."

Heriot Watt also expects that a third of its student from the rest of the UK will be able to get bursaries to help the new fees.

Scottish students will not be charged the new £9,000 a year fees because of an anomaly in European Union laws, which is expected to be challenged in court by several English students and the Birmingham-based law firm Public Interest Law.

Since the Scottish government does not charge its residents university fees, all other non-UK students are also entitled to free tuition under EU laws. However, as Scotland is a subsidiary part of the UK and is not a member state in its own right, it is able to treat other UK citizens differently.