A division bench of justices Arun Tandon and Rekha Dixit also asked officials of the University to take help of the police, if required to evict those staying illegally.
The court passed the order on an MA student Dharm Veer Singh's plea which said despite having been allotted a room in one of the hostels, he was not getting possession as some people were living there unlawfully.
Taking a serious view of the situation, the court remarked "no university, which has students' hostels attached to it, can run successfully unless it ensures that only legal inmates are provided facility of hostel rooms."
The court expressed concern over the submission of the varsity's counsel that previous attempts to evict unauthorised occupants from hostels had to be dropped midway "for want of assistance from the police".
The court then asked the district magistrate and the senior superintendent of police of Allahabad to ensure compliance with its orders and file affidavits to that effect on the next date of hearing on April 17.