London Metropolitan University has been given permission to challenge a ban on its recruitment of overseas students.
The High Court also ruled that existing students with full immigration status can continue their studies for now.
Last month the UK Border Agency took away the university’s right to sponsor students for UK visas.
It said the university was not making proper checks.
More than 2,600 students were affected.
They were told they had to find alternative courses or face being deported.
The UK Border Agency is cracking down on alleged abuse of the student visa system and London Met was the first university to lose its right to sponsor students from outside of the European Union for their visas.
It said the university had failed to address “serious failings” in its system which had been identified more than six months ago.
At the High Court in London, Richard Gordon for London Met had said the issue “came down to fairness”.
He said there was a strong case that the UKBA’s decision was unlawful and a temporary injunction should be granted, given the impact of the decision on the university and its students.
Mr Justice Irwin refused that request but did give the university permission to mount a full legal challenge in the form of a judicial review and made temporary orders protecting some students.
He said that existing overseas students and ones who are due to start this term would be allowed to start or continue as long as they are already in the UK and have full immigration status, pending a resolution of the issue.
In legal discussions before formal evidence was given, Mr Justice Irwin had told the court the interests of the students needed to be taken in to account.
And referring to students whose visa status was in order, he said: “I would be interested in respect of such students whether a concession could be made”.
The UK Border Agency (UKBA) took away the university’s “highly trusted status” – meaning it can no longer recruit students from outside the European Union – in a crackdown on alleged abuse of the student visa system.
Overseas students staying more than a year count in the migration figures and the government has pledged to cut net migration to “tens of thousands”.
The UK Border Agency has insisted the decision to revoke the sponsor licence was correct, saying the university had failed to address “serious failings” in its system.
In a sample of 101 students, it said, more than a quarter had no permission to be in the UK, while separate checks showed there was no proper evidence that some students spoke good enough English to be given a student visa.
Criticism was also made of the university’s attendance checks.
In court, Lisa Giovannetti QC, for the Home Office, said London Met had not deliberately breached the regulations and had made attempts to put things right, but had been unable to do that effectively.
Outside the High Court the university’s vice-chancellor, Professor Gillies said the judge’s ruling was good for students, who had been hugely confused by the action of the UK Border Agency, and would allow the issue to be looked at in a “sober and serious way”.
“It’s an important issue and there are lessons for all to learn,” he said.
The judge is still giving details of his rulings.
Last week the government pledged £2m to help students affected. A “task force” had been set up to help them find alternative courses.
Third year London Met student Donna Marie Winstanley, from Hong Kong, told the BBC News website she was pleased by the ruling.
“It’s really good,” she said.
“I have not applied to any other universities. I had a feeling that the university was going to win the case. Most of my classmates have already applied. I didn’t want to pay any more money. I had already paid £16,000 in fees for my first two years.”
Third year computer science student Ashiqur Rahman from Bangladesh said: “I am very happy if it’s true that I can continue my studies at the university, but I am waiting for confirmation”.
The National Union of Students has welcomed the ruling. It says the case has huge implications for international students in the UK and others thinking about coming to Britain to study and had asked to give evidence in the case.