The Enterprise has learned that the wanted man fired gunshots when police entered the home.

BROCKTON — Detectives went to the home with a warrant in hand for a man wanted on a child rape charge.

They were met shortly after, police say, by gunfire, which resulted in the wanted individual barricading himself in the house and eventually attempting to take his own life.

Detectives went to 95 French Ave. about 6:15 p.m. on Wednesday to attempt to arrest a man on a warrant.

We can deliver news just like this directly to your inbox. You can sign up for This Just In (a daily 7:30 p.m. newsletter with items we've posted that day), News Alerts (so you don't miss anything important) and more. It's customized to your preferences -- and it'll only take a few seconds.

"The police were there to execute a default warrant on a 25-year-old wanted on child rape charges out of Fall River District Court," said police spokesman Darren Duarte.

Police did not release his name, but The Enterprise has confirmed his identity as Admilson Oliveira. The Fall River Police Department filed a child rape charge against him on Aug. 6 and he was scheduled to appear in court again on Oct. 4 for a conference to review status, according to the Fall River District Court criminal clerk's office.

At the house, police say detectives saw Oliveira and asked him to stop because they had a warrant for his arrest.

"The suspect closed the door on the police and ran into an unlit room in the basement," Duarte said. "A detective followed until gunfire quickly erupted."

Detectives then exited the house and set up a perimeter. Police suspected that Oliveira had barricaded himself inside the home.

"Do we have a canine on tonight? Probably going to need one at 95 French Ave.," a detective told dispatch over his radio. "And can you send us some cruisers here, please? We have a situation. We don't know exactly what we have yet."

Several K9 units responded to the scene, including Brockton police officer John Sturdevant and his dog Gerry, West Bridgewater police officer Richard Flaherty and his dog Tazer and a Mass. State Police trooper and his dog, to assist detectives in re-entering the home to locate the man.

"Officers found the 25-year-old alongside a closet suffering from the self-inflicted wound," Duarte said. "Police recovered the .22-caliber handgun that was on his body."

Oliveira was found inside the home shortly before 7 p.m. He was treated at the scene by Brockton firefighters and Brewster Ambulance paramedics, then rushed by ambulance to Good Samaritan Medical Center in Brockton. He was later flown by medical helicopter to Beth Israel Deaconess Medical Center, where he remained Thursday.

Oliveira was still alive late Thursday afternoon, but his exact condition was not available. A hospital spokeswoman did not return a phone call seeking a patient condition status.

A spokeswoman for the Plymouth County district attorney's office said state police detectives assigned to the office were involved in the incident on Wednesday evening, but that Brockton police are leading the investigation.

Brockton police, in conjunction with state police detectives, are "conducting interviews with people who know the case and the suspect," Duarte said late Thursday afternoon.

Wednesday was not the first attempt police had made to execute the arrest warrant.

Brockton police patrol officers also attempted to pick Oliveira up on the same warrant late Tuesday afternoon, but were unsuccessful because he was not at the home.

Senior reporter Cody Shepard can be reached by email at cshepard@enterprisenews.com. You can follow him on Twitter at @cshepard_ENT.