About 500 cell locks opened at Montgomery County's main jail -- the second time in one week locks became unsecured in the facility near Clarksburg.

The incident caused officials to declare a security emergency.

Just after 12:00 a.m. on Saturday morning, jail workers were alerted that the cell locks had become open, said Art Wallenstein, director of the county's Department of Correction and Rehabilitation. He said he called police to secure the perimeter of the building, and extra staff were brought in to fix the problem.

No inmates tried to escape and the situation was handled without incident, he said. Police and staff were called as part of emergency situation procedure, he said.

The jail holds about 1,000 inmates and is the main jail for Montgomery County prisoners.

The locks for individual cells are all electronically activated and deactivated, and jail staff can see at any time which cells are open or closed. Though cell doors were not locked, Wallenstein said all other doors -- including exterior ones leading to the outside grounds -- were not affected by the malfunction.

The same issue happened earlier in the week on April 23rd, when the locks suddenly opened for an unknown reason. Wallenstein said he did not know the exact number of locks opened on Tuesday, but said it was "a large number."

Since then, officials from the Department of General Services and county maintenance employees have been working to figure out the cause of the malfunction. Wallenstein suspects it might be a software issue.

"We've been replacing our detention electronic system over the last several years," he said.

David Dise, director of the county's Department of General Services, did not return calls for comment on Saturday.

Wallenstein said that, though sometimes minor malfunctions do occur with individual cell locks, a mass outage is concerning to him. He called the incidents on Tuesday and Saturday "unique."

Staff are continuing to test the software and security systems for the locks to see if they can figure out why there was a malfunction. Wallenstein said at this time, they are still unsure the cause. The jail is still operating fully and programs are operating normally, Wallenstein said.

Despite everything going smoothly during the emergency situations on both Tuesday and Saturday, Wallenstein said he is still concerned there's is something wrong with the locks and it might happen again.

"We must solve this problem because we cannot continue to operate with the locks not working," he said. "Staff must believe the locks will work and that is why the attention given must be total and complete. There's no halfway."