Two teenagers have lost much of their legal battle against the raising of tuition fees in England.
Callum Hurley, from Peterborough, and Katy Moore, from London, claimed the decision to allow fees to rise breached human rights and equality laws.
The 17-year-olds had argued that higher fees would discriminate against poor and ethnic minority students.
High Court judges sitting in London rejected calls for ministers to reconsider the plans for higher fees.
They did say that the government had failed to comply fully with its public service equality duties, but said it would "not be appropriate" to quash the regulations bringing in higher fees because there had been "very substantial compliance".
The government has welcomed the decision, saying it is pleased the judges had "rejected outright" the suggestion that its student finance changes breached human rights.
The 17-year-olds' lawyers had argued that the "decision to increase the cap on university fees was unlawful, and should be quashed".
Their lawyers say they partially succeeded in their claim.
In a statement, Katy Moore said: "I am very pleased with the outcome. For the court to recognise that the government's actions were unlawful is a great achievement".
The teenagers had challenged Business Secretary Vince Cable's decision to allow universities in England to raise fees from £3,290 a year to up to a maximum of £9,000 from this autumn.
Fees are now set to rise in other parts of the UK too, although not for all students.
The students had claimed that the scale of such an increase in the upper level of fees was in breach of part of human rights legislation, which sets out a right to education and a right to education without discrimination on any grounds.
Their other claim was that the government had failed properly to assess the equal opportunity impact of raising tuition fees.
A spokesman for the Department for Business, Innovation and Skills said: "We are pleased the court rejected outright the suggestion that our student finance reforms breach students' human rights.
"The court recognised the consultation and analysis we carried out. It also recognised the extensive debate which took place, both inside and outside Parliament, on how those from disadvantaged backgrounds can be encouraged to enter higher education.
"Accordingly, the court has not agreed the claimants' request to quash the regulations, which set out tuition fee limits. This means that students and universities have the certainty to plan for the next academic year, and the government's higher education policies remain the same."
The Department for Business, Innovation and Skills has always insisted its changes to student finance are fair - and that going to university depends on ability - not ability to pay.
The judges said the government should pay half of the students' legal fees.
Callum Hurley is a BTec student at Peterborough Regional College and Katy Moore is taking her A-levels at Lambeth Academy in south-west London.
After the ruling, their solicitor, Tessa Gregory from Public Interest Lawyers, said: "Whilst our clients are disappointed that the court chose not to quash the regulations, they are pleased with the recognition that the government failed in its duties to properly think through the equality implications of its decision.
"The government has accepted that it must keep under review the impact of its measures and the court has stated that in doing so the government must actively seek out evidence where none is available."
Liam Burns, the president of the National Union of Students, said this was not the end of the challenge to the "government's disastrous higher education policies".
"The highest court in the land has pointedly not given the government a clean bill of health.
"It is high time that ministers came clean on the fact that a combination of inexcusably shoddy policy making and coalition horse trading has risked undermining equality of opportunity on grounds of gender, race and disability. It is now incumbent on ministers to reflect on this ruling and to rapidly change course."