A gunman shot and killed his ex-wife, their three children and himself in a small-town park as the woman prepared to hand over custody, police said Friday.

Their bodies were found Thursday evening in the tiny community of Unity when Maryland-National Capital Park Police officers stopped in the deserted park after noticing two cars with their engines running, said Wayne Jerman, Montgomery County assistant police chief.

The bodies of Gail Louise Pumphrey, 43, of Woodbine, and the three children — ages 6 to 12 — were found in the cars, Jerman said. David Peter Brockdorff, 40, of Frederick, was found nearby with what appeared to be a self-inflicted gunshot wound. Police said they recovered a .22-caliber rifle near his body.

The children included two boys, ages 6 and 12, and a 10-year-old girl, police said. Authorities did not release their names, saying they first wanted to contact the children's schools.

Pumphrey had met with Brockdorff to hand over custody of the children, according to investigators. Police did not know how long the children were to stay with their father.

Investigators did not know when the shots were fired, and no neighbors reported hearing gunshots, Jermain said.

The couple had a history of domestic violence, police said. They divorced in 2005.

Authorities blocked off roads Thursday in Unity, near the town of Laytonsville and about 25 miles northwest of Washington. The 1.5-acre park is in a sparsely populated area of mostly woods and farmland.

Residents gathered Friday at a general store down the road from the park and talked about the tragedy over pancakes and burgers.

"It's really shocking," said Sunshine Store cashier Christine Flaim, 24, who heard the sirens and helicopter from her home nearby. "This is a place where everyone knows everyone."

"I don't recall ever hearing of a murder here," she said. "Everyone is concerned and worried."

There have been several domestic killings involving children in Maryland this year.

In April, a father hanged his two young children before committing suicide in rural Boyds, in Montgomery County. In March, the remains of four young children were found in a town house in neighboring Frederick. The father's body was found hanging from a bannister, and the mother remains missing.