WISCASSET, Maine — A former Maine State Prison deputy warden has sued the state, claiming his repeated warnings about short staffing and its effect on safety resulted in his job being eliminated.

Former Deputy Warden James O’Farrell also claims in the whistleblower lawsuit that understaffing played a role in the murder of an inmate in the prison woodshop in May 2011.

O’Farrell’s lawsuit was filed Jan. 22 in Lincoln County Superior Court in Wiscasset. O’Farrell, a resident of the Lincoln County town of Waldoboro had worked at the prison for more than 33 years — including 12 years as deputy warden for security, before his position was cut in June 2011.

The lawsuit further alleges that the job cut came a day after he also had voiced concern to Warden Patricia Barnhart about her purchase of three properties from the state that were adjacent to the former prison site in Thomaston.

The prison had for years had difficulty filling officer positions at the prison and this understaffing led to a policy of having officers work overtime to fill vacant shifts, the lawsuit states. In March 2011, the new Commissioner of the Department of Corrections Joseph Ponte indicated he would be reducing the amount of overtime hours at the Maine State Prison, the lawsuit further claims.

Just days before the lawsuit was filed last month, Ponte had Barnhart replaced as warden — formally effective at the end of month — over issues that included excessive overtime being incurred at the prison.

O’Farrell states that he repeatedly voiced concerns to Ponte and Barnhart about safety concerns from lack of staffing. The former deputy warden said he believed the reduced staffing was increasing the danger of injuries or death to inmates, employees, and visitors at the prison.

Barnhart repeatedly warned O’Farrell to cease with his complaints about unsafe conditions or Ponte would respond by cleaning house, according to O’Farrell’s lawsuit. He states that on one occasion, Barnhart told O’Farrell that he would be next, in terms of a job cut, if he continued with his complaints to Ponte.

One specific concern that O’Farrell said he voiced concerned the reduction in officers in the woodshop from five or six to three. He also said only one officer was being assigned to oversee the mess hall during meals.

On May 24, 2011, an inmate was attacked and murdered by other inmates who beat the victim with a large, threaded metal rod in the wood shop, the lawsuit states. He said only three officers were in the woodshop and he spoke to Barnhart after the murder and said that this was specifically what he was concerned would happen.

Inmate Lloyd Franklin Millett, 51, died June 7 at Eastern Maine Medical Center in Bangor after a beating that occurred at the prison on May 24. A fellow inmate was indicted in April 2012 on two counts of aggravated attempted murder in connection with that death and the case is pending in Knox County Superior Court.

O’Farrell said he was informed on June 10, 2011, that his position was being eliminated.

The former deputy warden said that another deputy warden position had become vacant in March when the person holding the job died. O’Farrell said the department could have continued to employ him by moving him to that job of overseeing unit management, a position he had overseen in the other officer’s absence.

O’Farrell also stated in the lawsuit that he had complained to Barnhart about her purchase of three parcels owned by the state on the grounds of the former Maine State Prison site in Thomaston. That sale was later reversed on the advice of the Maine Attorney General.

The former deputy warden also filed a complaint with the Maine Human Rights Commission, which issued a right-to-sue letter.

The Department of Corrections had no comment when contacted Monday.