The New York City man who beat his wife's would-be rapist to death was released from custody on Tuesday evening to a chorus of cheers.

Mamadou Diallo was hailed by members of the Guinean community and his family as he left the Bronx Criminal Court after the judge freed him on his own recognizance.

The 61-year-old was arrested on Monday night and charged with manslaughter after he battered Earl Nash to death with a tire iron inside his Bronx apartment building elevator.

Diallo was outside his building when his wife, 51, called and said a man had broken in, dropped his pants and said, 'I'm going to rape you.'

Diallo ran inside, caught up with the attacker identified as Nash, 43, and fractured his skull with the steel lever as Nash tried to fight back with his belt, the NY Daily News reported.

Nash died at Lincoln Hospital from 'severe trauma to his head and body' about three hours later, according to police.

Scroll down for video

Support: Mamadou Diallo, 61, leaves Bronx Criminal Court surrounded by family and members of the Guinean community after being released on his on recognizance on Tuesday

Embrace: Family members react to Mamadou Diallo, 61, (center), being released

No doubt: Supporters react as Mamadou Diallo, 61, leaves Bronx Criminal Court after being released

Court appearance: Mamadou Diallo, 61, was charged with manslaughter for beating Earl Nash to death inside his apartment building in the Bronx in New York City

Accused: Diallo killed Nash after her tried to rape his wife after forcing his way into their home

Mamadou Diallo, 61, has been arrested on charges of manslaughter after he beat Earl Nash, 43, to death with a tire iron for trying to rape his wife, police said. Pictured, a bloody elevator at the Bronx apartment building

Nash (pictured left and right) broke into the apartment after knocking on several doors, according to PIX11. He hit Diallo's wife, ripped her clothes off and tried to rape her, according to police

Nash, who has a lengthy criminal history, slipped past the apartment building entrance around 10pm on Monday by following a resident in, according to PIX11.

He knocked on a number of apartments asking for water before the wife, identified as Nenegale Diallo by DNAinfo, opened the door thinking it was her son.

Nenegale's sister was also home at the time.

Nash forced his way in, locked the door behind him and started taking off his pants.

When Nenegale offered him money, he reportedly said: 'I don’t wan’t money. I’m going to rape you.'

Nash struggled with both women, attacking the sister first before hitting Nenegale in the head with a chair and and tearing off her clothes after she tried to run to the door for help.

The two women struggled with Nash for about 20 minutes and managed to fight him off long enough for Nenegale to call her husband.

Diallo, a cab driver, was in a car outside the building.

He rushed inside and found Nash on the sixth floor, where his wife was naked in the hallway.

She told the NY Daily News: 'While it was going on, I was thinking I was going to die. I told my husband, "Don’t let him out!"'

The two men fought inside the elevator, which was left covered in blood after Diallo fractured Nash's skull.

The wife, who was at home with her sister, managed to fight back and call Diallo (pictured Tuesday leaving the 42nd Precinct in the Bronx with )

Nash, who suffered a fractured skull, was taken to Lincoln Hospital in critical condition and died around 1.30am Tuesday due to 'severe trauma to the head and body', the police said

Nash was taken to Lincoln Hospital in critical condition, and died about three hours later at 1.30am Tuesday due to 'severe trauma to the head and body', the police said.

The 61-year-old cab driver was arrested on charges of manslaughter, and said, 'Self-defense. He threatened my wife. He threatened my wife,' as he left the 42nd Precinct today, ABC reported.

Diallo's wife has sustained minor injuries, like bruises and bumps on her head, but she told DNAinfo: 'I'm OK. I had a headache.'

The couple's son said, 'I was shocked, I was mad, I had many different emotions going through my mind,' before adding he was relieved his father stepped in.

Family members defended Diallo on Tuesday, saying he was trying to protect his wife.

Diallo was arrested once before, although the records are sealed. Neighbors suggested he was an upstanding citizen.

'He seemed like a fine gentleman. He’s a hard-working person. You don’t see him getting into any kind of trouble,' neighbor Amadu Kamara told NY Daily News.

Nash, who had 19 arrests on his record, was convicted for bribery and drug-related charges.

He was released on parole in July 2015, and was most recently arrested on May 14 for harassment.

In 2003, Nash pleaded guilty to the unlawful imprisonment of a 17-year-old, who he held captive for two days, after which authorities said she was sexually abused, stabbed and beaten.

Diallo has been arrested and charged with manslaughter, according to the NY Daily News