The two rectors could manage to leave the building only after an ambulance arrived there at 11 pm amid reports of some "medical emergency" with Mahapatra.
As of now, it was not immediately known where Singh and Mahapatra were taken to.
Earlier in the day, hundreds of students, led by the Jawaharlal Nehru University Students' Union (JNUSU), picketed outside all the gates of the building and confronted and stopped senior university officials who tried to go out.
Vice chancellor M Jagadesh Kumar was in his office.
In a statement, Registrar Pramod Kumar earlier said Mahapatra was feeling unwell and asked the students to disperse.
The students demanded the administration revoke the compulsory 75 per cent attendance required in an academic year for availing of scholarships and fellowships, and convene a meeting of the Academic Council which was postponed indefinitely.
Since 11 AM, a group of students performed skits and mimes and sang songs near the main entrance of the administration block. Security guards were deployed to block the students' entry into the building.
A human chain was also formed around the building.
"We are just following UGC guidelines not JNU guidelines. Students have all the right to protest as they feel it is injustice according to them. Ask anyone about compulsory attendance, they will say it is needed," Chief Proctor Kaushal Kumar, who was gheraoed for nearly two hours, told reporters.
Speaking about the attendance ruling, Kumar, who was allowed to leave later said, it was passed with a majority in the Academic Council.
"Though it was not mentioned in the agenda, one of the centres brought up the issue in the Academic Council and the VC said it must be implemented. The JNU works according to statutes and ordinances," he added.
In a letter written to the administration in morning, the JNUSU said, "Students of this university are waiting for the vice-chancellor to have a dialogue with JNUSU representatives."
"There has been no call to lay siege to the administration building. All administrative works have been going on without any obstruction," JNUSU joint secretary Shubhanshu Singh said, adding the gherao would continue till the vice chancellor met the students.
Rector-1 Mahapatra, when he was stopped by the students from going out, had earlier said he could not take a decision on the matter in individual capacity and that there would be dialogue with the students.
Registrar Pramod Kumar in the statement requested the students to disperse citing age, job responsibilities of the officials who were gheraoed.
"The administration has repeatedly requested the students to let the officials go out. Now the Rector-1 is feeling giddy and may require medical attention. The students are also protesting at the top of their voice and beating drums and obstructing the functioning of the varsity," he said in the statement.
After the statement was issued, the JNUSU called in an ambulance to treat Mahapatra's medical emergency but refused to disperse.
JNUSU President Geeta Kumari said until the students meet the Vice Chancellor and their demands are met they will remain there.
Calling the gherao an "illegal confinement", a group of professors sat on a dharna after they were not allowed to go in to let their colleagues out. The students raised slogans against the professors.
University Director R&D Rupesh Chaturvedi had said, "We will be going to the administrative building to free the rectors if we are not allowed to do that we will sit on dharna."
When the two rectors came out, the group of professors surrounded the two officials and helped them leave in the ambulance.
The students' protest was on till reports last came in.