About 500 locks on cell doors simultaneously opened inside Montgomery County’s main jail early Saturday, prompting officials to declare a security emergency that included posting about 20 police cars on the perimeter of the facility near Clarksburg.

No inmates tried to escape and the locks were reset, said Arthur Wallenstein, director of the county’s Department of Correction and Rehabilitation.

Wallenstein said the cell-door locks also disengaged Tuesday before being reset. “It’s definitely a problem,” he said. “We must find the source of it.”

County maintenance workers and outside contractors were in the jail Saturday working on the system to find a permanent fix for the doors, Wallenstein said. The doors are part of an electronic system guided by computer programs and corrections officers.

Only cell-door locks opened, Wallenstein said. No housing unit doors or hallway doors were affected, he said. Beyond those perimeters, inmates trying to leave would still have to get past corrections officers and a fence. Wallenstein said no inmates left their cells.

Still, the situation is hardly an ideal one for a jail.

“Any security door opening in an unexpected manner constitutes a major security problem,” Wallenstein said.

In addition to calling in the police perimeter, Wallenstein and other corrections administrators went to the jail early Saturday morning. The locks opened about 12:20 a.m. Some were reset immediately; others were reset within an hour. Officials tested the locks until 5:45 a.m., when they let the last of the police leave.

“We handled it as a security emergency,” Wallenstein said. “But nobody tried to escape.”