A Newtown woman shot her two sons as they lay sleeping in their beds early Monday, and attempted to kill a neighbor who came to investigate the sound of gunfire, Bucks County prosecutors said.

Trinh Nguyen, 38, was charged with three counts of attempted murder and related charges, Bucks County District Attorney Matt Weintraub said Monday. But two of those charges will soon be upgraded to murder, he said: Nguyen’s sons, 9 and 13, were being kept on life support until their organs could be donated through the Gift of Life program.

Weintraub, his voice thick with emotion, said he struggled to get the images of the shooting out of his head.

“I have two kids, and this couldn’t hit any closer to home,” he said during a news conference at the county courthouse in Doylestown. “I’ve kept saying my prayers since I got the call this morning.”

The motive for the shooting remained unclear Monday, said Weintraub, who added that the investigation was in its early stages.

Court records indicate that Nguyen had been locked in a dispute with her landlord, Corinna Tini-Melchiondo, for several months over more than $11,000 in unpaid rent. A magisterial judge had ruled in Tini-Melchiondo’s favor and ordered Nguyen and her family to leave the home on Timber Ridge Road by Tuesday, the records show. Tini-Melchiondo hung up on a reporter when reached Monday afternoon.

Her brother, Ed Tini, was married to Nguyen until last spring, when she filed for divorce, according to civil court records. Tini is the father of Nguyen’s younger son, law enforcement sources familiar with the case said.

The home Nguyen lived in is part of a duplex shared with other members of the Melchiondo family, who were awakened early Monday by the sound of gunfire.

When Gianni Melchiondo, 22, went to investigate, he found Nguyen on the front lawn, holding a box of photos, according to Weintraub.

Nguyen asked Melchiondo if he would deliver the photos to her ex-husband, who works with him, investigators said. Melchiondo agreed, and when he took the photos from Nguyen, she pulled out a black revolver and aimed it at him, pulling the trigger twice.

But “by the grace of God,” Weintraub said, the gun did not fire, and Melchiondo was able to wrestle it away from her. Nguyen then sped away in her minivan, he said.

Inside the home, officers found Nguyen’s two sons in their bedrooms, both shot in the head, Weintraub said. They were taken to St. Mary Medical Center in critical condition.

Hours later, administrators at the Washington Crossing Methodist Church called Upper Makefield Police, saying Nguyen’s van was parked on the church’s property. They recognized the vehicle from social media posts by police, who were seeking to arrest her.

Officers descended on the parking lot and apprehended Nguyen. They rushed her to St. Mary Medical Center because she had ingested narcotics in a failed attempt to kill herself, according to Weintraub. At the time of her arrest, Nguyen had additional ammunition for the gun, which she legally purchased, with her in the van, authorities said.

Nguyen’s neighbors on Timber Ridge Road were reluctant to comment Monday, saying only that she seemed close to her sons.