NEW YORK — Power was restored Sunday night at a federal detention center in New York City where inmates had been living largely without heat or electricity for the past week, according to a statement from the Federal Bureau of Prisons.

Protesters have gathered outside the Metropolitan Detention Center in Brooklyn in recent days following news reports that those housed there have largely been without heat or power for the past week and also haven’t been able to communicate with lawyers or loved ones. Outdoor temperatures have been well below freezing on some recent days, though Sunday was warmer.

In its statement the agency said it was “working to restore the facility to normal operations.”

Earlier Sunday, some demonstrators attempted to enter the facility, and guards drove them back with pushes and shoves. Witnesses said they also used pepper spray. A reporter and photographer for The Associated Press were at the facility when a woman, whose son is being detained, tried to get into the jail.

On Sunday, an inmate was able to call through the window of his cell, which faces out to the street, to his mother below. The woman, Yvonne Murchison, was crying and upset and tried to get into the facility, where visits have been stopped.

“I’d trade places with him any day, that’s my child,” she said.

She was followed by activists and media into the lobby, where visitors have to pass through metal detectors.

Witnesses said officers used significant force to push the people out, with some of those attempting to come in being pushed to the ground. Those affected by spray were seen washing out their eyes with water or milk.

The Bureau of Prisons has acknowledged that the jail “experienced a partial power outage due to a fire in the switch gear room.” The bureau had said a new electrical panel is being installed by an outside contractor and work is expected to be completed by Monday. It wasn’t clear if that work was completed Sunday night with the restoration of power. The agency insisted that inmates had hot water for showers and sinks, and were getting medications as needed.

The jail administration did not return an email seeking comment on the clash Sunday.

New York Gov. Andrew Cuomo called for an investigation of the circumstances of the loss of heat and electricity by the federal Department of Justice, saying the situation was “a violation of human decency and dignity” and also raises “questions of potential violations of law.”

The Democrat said he wanted answers, and those responsible held accountable.

“Prisoners in New York are human beings,” Cuomo said. “Let’s treat them that way.”

The New York Civil Liberties Union released a statement Sunday calling on the Bureau of Prisons to “ensure that no detainee be subjected to retaliation for peacefully protesting.”

“Today’s confrontation between the Bureau of Prisons and family members of people jailed at MDC highlights the desperate need to address the dangerous, inhumane and unlawful conditions inside the facility,” NYCLU executive director Donna Lieberman said.