An inmate stabbed Derek Chauvin 22 times last week at a federal prison in Tucson, Ariz., the U.S. Attorney’s Office in Arizona said on Friday in announcing attempted murder charges.

The inmate, John Turscak, 52, who is accused of stabbing Mr. Chauvin with an improvised knife on Nov. 24, told investigators that he had been thinking about attacking Mr. Chauvin for about a month because Mr. Chauvin — who is serving more than 20 years in prison for murdering George Floyd — is a high-profile inmate, according to charging documents.

Mr. Chauvin survived the attack.

According to a criminal complaint, Mr. Turscak attacked Mr. Chauvin inside the law library at the Federal Correction Institution, a medium-security prison in Tucson. Officers responded immediately and used pepper spray to subdue Mr. Turscak, court documents state.

Mr. Turscak told officers that he would have killed Mr. Chauvin “had they not responded so quickly,” according to the complaint.

In an interview two days later with F.B.I. agents, the inmate denied wanting to kill Mr. Chauvin but revealed that he been planning the assault for about a month, the complaint said.

Mr. Turscak said the date of stabbing, the day after Thanksgiving known as Black Friday, was “symbolic with the Black Lives Matter movement and the ‘Black Hand’ symbol associated with the Mexican Mafia criminal organization,” according to charging documents.

In addition to the attempted murder charge, Mr. Turscak was charged with assault with intent to commit murder, assault with a dangerous weapon and assault resulting in a serious bodily injury, federal prosecutors said in a news release.

The court docket did not list a lawyer for Mr. Turscak on Friday.

A previous criminal case involving Mr. Turscak was listed as sealed in a federal court database, though records from the Bureau of Prisons listed a 2026 release date.

In 2001, a man with the same name as Mr. Turscak was sentenced in Los Angeles federal court to 30 years in prison, The Los Angeles Times reported at the time. The man was a former Mexican Mafia member and had been convicted of crimes he committed while he was an F.B.I. informant, according to the article.

In the stabbing of Mr. Chauvin, the charges related to attempted murder each carry maximum sentences of 20 years in prison, while the assault charges each have a maximum of 10 years, prosecutors said.

Mr. Chauvin, a former Minneapolis police officer who is white, murdered Mr. Floyd, who is Black, during an arrest on a South Minneapolis street corner in May 2020.

Mr. Chauvin knelt on Mr. Floyd for nine and a half minutes as Mr. Floyd was handcuffed, face down on the street.

Mr. Chauvin is serving a sentence of 22 and a half years on the state murder charges, and a concurrent sentence of just over 20 years for violating Mr. Floyd’s constitutional rights.

Glenn Thrush contributed reporting and Kirsten Noyes contributed research.