This undated family photo provided by Lauren Williams shows Canaan federal penitentiary correctional officer Eric Williams. Williams, 34, was attacked and killed by an inmate using a homemade weapon Feb. 25, 2013. It was the first fatal attack on a federal corrections officer in nearly five years, officials said Tuesday. (AP)

A corrections officer at the Canaan federal penitentiary in Pennsylvania was killed by an inmate late Monday night, according to prison officials, marking the first slaying of a federal prison guard in nearly five years.

Officer Eric Williams, 34, of Nanticoke, Pa., was working in a housing unit at the high-security federal facility in Northeast Pennsylvania when he was beaten and fatally stabbed with a homemade weapon, according to the U.S. Bureau of Prisons.

Williams had served with the bureau for less than two years, the agency said.

“This is clearly the darkest day in our institution’s short history, and we are in shock over this senseless loss of a colleague and friend,” David Ebbert, Canaan’s warden, said in a statement Tuesday.

The bureau said that an investigation into Williams’s death was underway and that prison staff had restrained an individual after the incident.

This Feb. 26, 2013 photo shows the U.S. Penitentiary in Canaan, Pa., Wayne County, where Eric Williams, 34, of Nanicoke was killed by an inmate who used a homemade weapon Monday night. (Michael J. Mullen/AP)

Union officials mourned Williams’s death but also seized on the incident to criticize Washington for the government-wide spending cuts that are set to take effect Friday if Congress fails to reach an alternative deficit-reduction deal. They said the threat of staffing reductions could put corrections officers at greater risk.

“With furloughs, I shudder to think of what could happen,” said Dale Deshotel, president of the Council of Prison Locals. “If you start furloughing people, you remove another percentage of the officers, and it’s going to get even more dangerous.”

The bureau did not address the cuts, but the agency said its facilities would benefit from more personnel.

“Staffing has always been an issue,” spokesman Chris Burke said. “It’s safe to say that higher staffing levels do contribute to safer institutions.”

The attack on Monday occurred while Williams was locking prisoners into their cells for the night, according to union officials who had spoken with other guards at the facility. Williams was unarmed and working alone at the time, union officials said.

The bureau generally prohibits corrections officers from carrying weapons at work, although a few exceptions apply: Guards can use batons during emergency situations, and a few prisons have allowed personnel to carry pepper spray as part of a pilot program. Canaan is not one of those facilities.

Another officer who arrived to assist Williams with a routine inmate count discovered the officer’s stabbed and beaten body, union officials said.

They said that corrections officers should not have to work alone and that they have lobbied Congress for several years to provide more personnel funding.

“Staffing levels contributed to this death,” said Darrell Palmer, president of the AFGE Local 3003, of which Williams was a member. “It all comes down to the things we’ve been asking for since José Rivera passed away.”

Rivera was stabbed at the Atwater penitentiary in California in 2008, according to the Council of Prison Locals.

Local 3003 officials wrote to Congress less than nine days before the officer’s death, urging lawmakers to oppose any measure that would reduce pay, retirement or benefits for its members. The message referred to Rivera’s 2008 murder as an example of the dangers prison authorities face.

The Justice Department said the automatic spending cuts set to take place Friday would force the Bureau of Prisons to trim $338 million from its budget, requiring 12 days of furloughs for all employees within the agency.