The buildings soon filled up, and women and children were released, leaving several thousand men inside, including 4,000 in one of the mosque compounds.
Besides causing the collapse of the courtyard wall the explosion also destroyed a building just inside the mosque compound.
The mosque compound and minarets had been closed since the 2006 bombing.
The mosque compound was built about 1,300 years ago over the ruins of the biblical Jewish Temples.
The government later reconstructed the demolished portions of the mosque compound.
A line of young men with AK-47's stood stiffly at attention as a visitor entered the mosque compound.
In the past, Muslim authorities have carried out renovations of their own at the mosque compound.
A 20-year-old man was killed on Friday night during a shootout near the mosque compound, but it is unclear who fired the fatal shot.
Last year, a library in the mosque compound was set on fire by Indian forces and thousands of books were destroyed.
Tanks had rammed through the mosque compound's outer wall, leaving large holes.