In a Maryland courtroom last year, Jean Natera Perez’s girlfriend told a judge why she needed a restraining order to keep him away.

During an argument over loud music, she said, he smashed her CD-radio player into a wall, dragged her by the hair and kicked her in the eye. A month earlier, she said, he had broken her phone and pushed her down steps.

“You never know,” the 26-year old told the judge in the recorded hearing. “Sometimes he can walk away, and sometimes he just snaps.”

That same volatility and anger, police say, propelled Natera Perez to barricade himself Monday with his 3-year-old son in a townhouse in Montgomery County. He sliced his finger, wrote “I love u and family” in blood on walls in the house, broke dishes and furniture. And when hostage negotiators tried to get him to release his son and leave the house, he refused.

After more than two hours, police say, Natera Perez grew more erratic.

He tossed a flaming object from a second-floor window of the house on Mozart Drive in the Fairland area of Silver Spring, and began setting clothing on fire.

Smoke alarms sounded, the boy screamed, and the SWAT team moved in.

One member shot Natera Perez in the head.

Others reached the boy, who was uninjured and sitting beside a bed next to a bloody knife — his father’s crumpled body nearby on a floor.

The shooting was the second officer-involved fatal shooting in the past six weeks for the county police. The 1,300-member force had one such fatal shooting from 2015 to 2017.

Natera Perez, 30, died Wednesday at a Bethesda hospital, shortly after doctors disconnected life-support machines. More than a dozen family members surrounded his bed. “May you rest in peace,” said his father, Juan Natera, recalled a sister, Dilcia Natera, who was there.

A few minutes passed. The lines on the monitor went straight. “We covered him,” Dilcia Natera said, “and we left.”

The standoff had begun Monday about 8 p.m., when Natera Perez went to his ex-girlfriend’s home. On the first 911 call, police said, a woman was screaming and the call taker heard a male voice say “I will kill you,” before the line was disconnected.

According to police, Natera Perez had gone to the house and seen his ex-girlfriend there with her new boyfriend, and assaulted them before they fled. Natera Perez then stayed inside with his son.

Family members questioned the shooting, saying police over­estimated the threat Natera Perez posed to his son. What may have seemed like chaos from the outside, Dilcia Natera said, was a man overcome by two emotions: wanting to kill himself, and wanting to be around the person he most cared about — his young son.

“It’s just so, so sad,” she said.

If the tactical officer who killed her brother was skilled enough to shoot him in the head, she said, he could have aimed elsewhere. “Any shot would have gotten him down,” she said.

“All lives are important in these events,” Montgomery Police Chief Tom Manger said in an interview Wednesday. “But in a hostage-barricade situation, the priority is the life of the hostage.”

In general, police are not trained to shoot at limbs to slow down a threat. Officers are trained to use their firearms in cases of imminent threat that would justify the use of lethal force.

Hostage negotiators spent more than an hour speaking to Natera Perez — in English and Spanish. Officers also saw him barricading doors and windows with furniture, police said.

“As long as negotiations are going on, time is on our side,” Manger said.

But the tactical commanders saw a rapid escalation of dangers.

“The situation changed when Mr. Perez was observed lighting something on fire in the upstairs bedroom” and officers saw smoke and heard the alarms and screaming boy, Manger said.

“At that point, we had to act immediately,” he said.

He and other police officials declined to say how the SWAT team entered the house, or where the officer was standing when he fired.

Officials identified the SWAT team member who fired the fatal round as Officer Edward Cochran, an eight-year veteran of the force. He was placed on administrative leave, which is the department protocol after a fatal shooting.

One of four siblings, Natera Perez was born in the Dominican Republic and immigrated to the United States when he was 14, settling in Massachusetts with his family, Dilcia Natera said.

He worked as an automotive painter and held on to his roots: listening to Dominican music, going bachata dancing and playing dominoes. “He was a very live spirit,” his sister said.

After a move to Maryland, he and his then-girlfriend had a child in October 2014 and lived together.

In April 2017, she went to court and obtained the restraining order for alleged attacks against her. She told the judge that Natera Perez had never abused their son, the hearing record shows, and that she wanted him to be able to see the boy and help raise him.

As the couple drifted apart, though, Natera Perez grew depressed, Dilcia Natera said.

“He just wanted them to be together as a family,” she said. “He said the only thing he had left was his son.”

On Monday night, his sister said, “He was not in his right state of mind.”

On Wednesday, she and other family members walked through the ex-girlfriend’s townhouse and saw the damage there.

“The house was completely messed up,” Dilcia Natera said. “But he was never going to hurt that baby.”