WARREN — The head of the state’s prisons has revised the policy for screening visitors, after corrections officers at the Maine State Prison filed a grievance.

Maine Corrections Commissioner Joseph Fitzpatrick issued the new policy late Friday, replacing a temporary policy that was instituted after complaints that some female visitors were being asked to remove their bras before they were allowed to visit inmates.

Under the new policy, visitors will be required to pass through two metal detectors, and be given three tries to successfully pass. If they can’t, they will not be allowed to visit.

“Visitors wishing to leave and fix their outfit which may be the cause of the unsuccessful metal detector attempt may do so and then return before their third attempt,” according to the new policy implemented on Friday.

Fitzpatrick said Monday the new policy balances the safety of staff and the public at the prison and respect for visitors.

A previous, temporary policy imposed by Fitzpatrick that prohibited staff from asking women to remove their bras if the wire in them was believed to have set off the metal detectors, fell afoul of the corrections officers.

Jim Mackie, representative for the corrections officers with the American Federation of State, County, and Municipal Employees, filed a class action grievance last week with the department on behalf of officers, who said they were concerned that the new directive placed them at risk by allowing a visitor to sneak in a weapon.

Under the temporary policy, visitors could enter the prison even if they set off the metal detectors, if no weapon was apparent. The visitors would be allowed in for a non-contact visit.

Fitzpatrick said he opposed patting down visitors, saying staff should not be putting their hands on the public.

Mackie said he couldn’t confirm that any officers requested women to remove bras in order to get into the prison. Fitzpatrick also said he couldn’t confirm that women had been asked to do so, but issued the directive after he was contacted by the media about complaints from women.

In 2015, female attorneys visiting clients at the Cumberland County Jail in Portland lodged complaints when they were told by guards that they had to remove their underwire bras before they could meet with their clients. Sheriff Kevin Joyce later apologized, blaming a misinterpretation of a revised jail policy on metal detectors, which called for scanning visitors who trigger the metal detector with a wand.

Mackie did not immediately respond to phone messages Tuesday morning on the revised policy.