Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

An FBI agent fatally shot a kidnapping victim during a botched raid early Thursday inside a Houston home, leading Texas authorities to say "the system failed."

As the circumstances surrounding the man's death remain under investigation, three suspects in the kidnapping were in court Friday morning on charges of taking part in a chaotic plot that police say involved a home invasion, the escape of a child and a ransom demand.

"The system failed," Philip Dupuis, the police chief in Conroe, said at a news conference Thursday about the victim's killing. "We do this job to help people and it doesn't always go our way."

The Houston raid, which occurred before 4 a.m. CT (5 a.m. ET), jolted neighbors — one of whom told NBC affiliate KPRC they awoke to bullets flying: "We just heard gunshots. It was like four pop, pop, pops."

What led the FBI agent to open fire was not clear.

Police said the incident began Wednesday morning when officers responded to a disturbance call at a home in Conroe, a suburb north of Houston, that belonged to a man later identified as Ulises Valladares, 47.

As Valladares' 12-year-old son was getting ready for school, two men burst into the home and held the pair up at gunpoint. The men demanded money, bound the father and son with duct-tape, and ransacked the home for valuables, police said. They grabbed a PlayStation, an Xbox, a sword and hat.

The armed men then put a black sweater over Valladares' head and led him from the home. They instructed the boy, who was still bound, to stay behind and not contact police, Dupuis said.

Once the men left, the boy was able to free himself with scissors and run to a neighbor to call police when he couldn't find his father outside.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Meanwhile, an uncle arrived at the house and got a phone call from a man demanding money in exchange for Valladares' return, police said.

According to court documents, the man on the phone said in Spanish that he was part of the Mexican drug and crime syndicate known as the Gulf Cartel and that he wanted $20,000 as ransom.

Kidnapping victim Ulises Valladares was shot in a botched FBI raid. via Facebook

The caller added that they were watching the house and if police became involved in the ransom exchange, Valladares would be killed. Court documents said the boy had overheard the two suspects saying that the father's brother owed them $8,000.

The uncle denied knowing anyone matching the suspects' description or that he owed anyone money, court documents said.

Meanwhile, Conroe police contacted the FBI, and agents using a federal warrant traced the caller's phone to the area of a Best Western hotel about an hour away.

Valladares was not at the hotel, but agents on surveillance of the location found two suspects matching a description given by the son. Agents also located the cellphone used to call the brother, according to the court documents.

From left, Jimmy Tony Sanchez, Nicholas Chase Cunningham and Sophia Perez Heath. Conroe Police Department

Nicholas Chase Cunningham, 42, and Jimmy Tony Sanchez, 38, were arrested Wednesday night and were charged with aggravated kidnapping and aggravated robbery. Police said Cunningham's wife is the niece of Valladares' brother.

In addition, a third suspect — Sophia Perez Heath, 35 — was arrested and charged with aggravated kidnapping.

Cunningham told investigators that Valladares was being held at Heath's home in northeast Houston, according to court documents. Heath is described as Cunningham's girlfriend, and she was allegedly ordered by Cunningham to watch and feed Valladares at her home.

During a court hearing Friday, Cunningham and Sanchez were denied bond. A judge set Heath's bond to $1 million, and must wear an ankle bracelet if she makes bail.

UPDATE: @FBIHouston says an agent shot and killed a man at the home on Elbert in NE Houston during an operation. Multiple people were inside, including at least one child. No word yet on what the operation involved. @KPRC2 pic.twitter.com/E3YMhe9Ln0 — KPRC Cathy Hernandez (@KPRC2Cathy) January 25, 2018

The reason for the gunfire during the raid was not detailed during Thursday's news conference with the FBI in Houston. Valladares' hands had still been bound in duct-tape when agents arrived. He later died at the hospital.

In addition, other people were inside the home at the time of the operation, including children.

The FBI said the shooting was being investigated by an internal incident review team and results will be shared with the Department of Justice and local police.

"The FBI takes very seriously any shooting incidents involving our agents and as such have an effective, time-tested process for addressing them," the agency said in a statement.

The agent who shot Valladares has been placed on paid administrative leave pending the outcome of the investigation.

"We've got the bad guys," Montgomery County District Attorney Brett Ligon told reporters Thursday. "Even though it's good work on behalf of Conroe Police Department, it's still a tragedy."

CORRECTION (Jan. 26, 2018, 12:26 p.m.): An earlier version of this article misspelled the last name of the man who was killed in a botched FBI raid. His name is Ulises Valladares, not Villadares.