ISTANBUL — The head of Iran's prison authority apologized Tuesday after a hacker group released footage showing guards beating and kicking inmates at a notorious prison for political detainees and foreigners.

The footage, from northern Tehran’s Evin Prison, was distributed to news outlets including the Associated Press, which first reported on the leaked video and said time stamps on the footage showed it was recorded in 2020 and this year.

Scenes from the video showed what appears to be a suicide attempt by a man using glass from a bathroom mirror he smashed, guards dragging an emaciated man along floors and stairs and two men — a guard and what looks like another prison employee — engaged in a bloody fistfight, as other prison employees watch and try to separate them.

Another clip, near an automated teller machine, shows a man wearing a blue uniform being struck on the head repeatedly by one guard, and then kicked by another.

The Associated Press said the group that shared the videos, called “the Justice of Ali,” claimed to have “hundreds” of gigabytes of data from a hack conducted several months ago.

“I take responsibility for these unacceptable behaviors,” Mohammed Mehdi Haj-Mohammadi, the head of Iran’s Prisons Organization, said in a message posted on his Twitter account Tuesday, in a rare acknowledgment by the authorities of official abuse. “I will commit to not letting these horrific incidents being repeated, and deal seriously with law breakers,” he added.

The prison, built in 1971 during the rule of Shah Mohammad Reza Pahlavi, soon gained notoriety for human rights abuses. Thousands of political prisoners were held “in horrifying conditions, tortured” and executed there by the shah’s secret police, Human Rights Watch wrote in a 2004 report.

After the 1979 Iranian revolution, Iran’s clerical rulers continued to hold political prisoners at Evin, which was the scene of mass executions in 1988 — an episode linked to Ebrahim Raisi, Iran’s newly elected president, who served on a panel involved in sentencing prisoners, according to human rights groups.

More recently, Iranian authorities have held foreigners or Iranians with dual nationality there — prisoners Tehran has used as bargaining chips for the release of Iranians held in the West or other concessions. Among them are several Americans, including Emad Shargi, a businessman; Morad Tahbaz, an environmentalist; and Siamak Namazi, a businessman who was arrested in 2015.