(CNN) -- A federal judge's ruling Wednesday cleared the way for a controversial mosque in Tennessee to open in time for the start of the Muslim holy month of Ramadan.
County officials must conduct a final building inspection at the mosque in Murfreesboro, near Nashville, U.S. District Judge Todd J. Campbell said in a temporary restraining order.
The order will allow the mosque to complete the inspection process so it can use its building in time for the religious holiday of Ramadan, which starts at sunset Thursday, the Becket Fund for Religious Liberty said in a statement.
"This is a great victory not just for the Muslims of Murfreesboro, but for people of all faiths. No house of worship should be kept from meeting just because the neighbors don't like their religious beliefs," said Luke Goodrich, deputy general counsel at the Washington-based fund, which represented the mosque in a federal lawsuit.
The U.S. Justice Department and the Islamic Center of Murfreesboro filed separate lawsuits this week, arguing that Rutherford County officials violated federal laws when they denied requests for a final inspection and certificate of occupancy for the mosque.
The center argued that it was being unconstitutionally blocked "merely because local anti-Islamic protests have made the mosque controversial."
Justice Department officials coordinated the timing of their lawsuit with the local case because they thought there would be "irreparable harm" if the mosque were not allowed to open for Ramadan, spokesman Mitchell Rivard said.
Plans for the mosque have resulted in threats to the center and a lawsuit that led to a county judge's order shutting down the project in June. County officials had cited that order when they denied requests for the final inspection.
The construction site had been vandalized multiple times, including by an arson attack in 2010, and federal authorities have charged a Texas man with calling in a bomb threat to the center before last year's anniversary of the September 11, 2001, attacks on New York and Washington.
The center's lawsuit argued that it was ordered to meet "a heightened standard of notice in the zoning process" because of objections by some Murfreesboro residents, a standard no other religious institution has been asked to meet.
"This double standard for the mosque has deprived ICM of its legal rights under federal law and the Constitution, serves no public purpose and threatens to cripple ICM's ability to observe Ramadan," the lawsuit states.
The project had been approved by a planning commission and was under construction when Corlew reversed that approval because of what he said was the insufficient notice. The county followed its normal practice of publishing notice of the hearing in the local newspaper, but Corlew said more should have been done because the mosque was "an issue of major importance to citizens."
Four county residents filed suit to block the mosque in September 2010, arguing it posed a "risk of terrorism generated by proselytizing for Islam and inciting the practices of Sharia law" and that planning commissioners violated their due process rights. They also demanded the judge bar any approval until the Islamic center showed that it was not interested in "the overthrow of the American system of government, laws and freedoms guaranteed by our Constitution."
On Wednesday, Campbell ruled that the Justice Department had "demonstrated that the mosque is necessary to accommodate the number of worshipers, especially during the holy season of Ramadan, which begins July 20. The new building, which is ready to serve the community, eliminates the facilities problems, providing ample space for prayer, holiday celebrations, religious meetings and children's play."
Imam Ossama Bahloul said in a statement that the center was "delighted by the judge's decision."
"We look forward to celebrating Ramadan with our neighbors," he said.
CNN's Joe Sutton and Carol Cratty contributed to this report.