The Hogan administration and Maryland’s correctional workers union have struck a deal that will allow dozens of employees who were recently threatened with layoffs to keep their jobs.

The agreement ends a protracted battle between union leaders and Stephen T. Moyer, the secretary of the state’s Department of Public Safety and Correctional Services, over a plan that Moyer said was designed to root out corruption in the prison system but would have also eliminated about 30 positions. The secretary had originally said 63 positions would have been affected.

Under the deal, the employees will be reassigned to vacant positions either at a prison or probation and parole facility. They will remain at the same salary and move to a location no more than 50 miles from their current job.

Patrick Moran, president of AFSCME Maryland Council 3, said in a statement that he was pleased to reach an agreement with Moyer that “respects the service of and protects the jobs of these hard-working employees, while still allowing the department to reorganize human resources functions.”

Moyer asked the state Board of Public Works two months ago to allow him to eliminate the jobs so he could streamline the personnel department and consolidate separate personnel staffs at each prison into one office to ensure uniform hiring and firing practices.

JESSUP, MD -- AUGUST 06: The Maryland Correctional Institution for Women is the state's only prison for women. (photo by Andre Chung for The Washington Post) (Andre Chung/for The Washington Post)

To emphasize his point, the secretary told the Board of Public Works last month that more than 250 corrections employees have been arrested since 2013 on charges ranging from assault to looting to having sexual relations with inmates. Moyer said his office needs better control over hiring and firing, because 200 of those workers are still on the job.

He also referenced the recent closure of the men’s jail at the Baltimore City Detention Center, where corruption ran rampant for years with the help of prison guards.

But several of the employees who were in danger of losing their jobs told the state panel, which consists of the governor, treasurer and comptroller, that they were being forced out even though they had nothing to do with the problems Moyer raised.

“I’m 63 years old, and I’m trying to figure out — what did I do?” Emily Eubanks asked the state panel. She said she would have lost her job under the proposal.

“Our problem with this was that these people don’t hire and fire anybody,” said Jeff Pittman, a union spokesman. “They have stellar job performances. If they signed a termination letter, it was because a warden told them to do it.”

Maryland Comptroller Peter Franchot (D) and Treasurer Nancy K. Kopp (D) said they were sympathetic to the employees’ circumstances, a strong indication that the cuts would not get approved by the three-member panel. Gov. Larry Hogan (R) deferred action on the vote and instructed Moyer to figure out an alternative.

“Gov. Hogan asked that we look at it a different way to achieve the same results, and we have done that,” Moyer said in a conference call with reporters.

Moyer said his plan to root out corruption is continuing to move forward, including making changes to fingerprinting requirements when employees are hired and altering the process for handling disciplinary cases to ensure that his office becomes aware of offenses more quickly.