THE BRONX — A Bronx man was released from jail Tuesday night after police said he beat a man to death who had attempted to rape his wife.

Mamadou Diallo, 61, was released on his own recognizance and still faces manslaughter charges in the death of 43-year-old Earl Nash.

The charges come after Nash allegedly attacked Diallo’s wife, ripped her clothing, and attempted to rape her after forcing his way into her Bronx apartment.

During the assault, police say the 51-year-old woman was able to call her husband, who was outside.

The wife apparently fought off Nash, who then left and is seen on surveillance footage approaching an elevator in an apparent attempt to leave.

That’s when police say Diallo spotted Nash, and the two faced off in the apartment’s sixth floor hallway.

Diallo, armed with a metal pipe, is accused of then beating Nash to death.

Although police on scene initially said it was unclear if Diallo would be arrested, prosecutors later said he faced charges because the beating occurred after the woman’s attack.

Nash’s nephew told PIX11 News on Tuesday that his uncle was schizophrenic, and may have seemed “off,” but was not violent.

Nevertheless, dozens of people have said they understand Diallo’s actions, and several attended his Tuesday night release from jail to offer him praise and cheers.

“He seems like a very decent man,” Diallo’s attorney Anthony Michaels said. “He’s had absolutely no problem with the law. He’s not going out looking for trouble, trouble came to him, came to his house. People attacked his relatives and he responded in a way that’s pretty natural.”

Diallo is expected to return to court on June 27.