The search for a man charged in the deaths of his wife and four daughters in the United States ended in the hills of a northern Mexico town where authorities say the suspect threatened to take his life as officers closed in on him.

Juan David Villegas-Hernandez was taken into custody by Sonora state police on Sunday — a day after police in Roswell, New Mexico, said the 34-year-old shot and killed his wife, Cynthia Villegas, and their four daughters — ages 14, 11, 7 and 3.

The mother, who also was 34, was a well-respected employee of the Eastern New Mexico Medical Center, said Roswell Mayor Dennis Kintigh, who spoke with the CEO of the hospital on Sunday.

"This rippled through town quickly," he said. "Candidly, it's hard to get your mind around the deaths of small children. It's hard for law enforcement; it's hard for family members and the whole community."

He described Roswell, a desert town in southern New Mexico, as a community that can often feel isolated from much of the rest of the state. It's home to about 50,000 people.

Records show that nearly 10 years ago the Villegas purchased their home in Roswell, where the shooting happened. Before that, it appeared Villegas-Hernandez had lived in Sierra Vista, Arizona.

He is originally from Arizpe, a city in the Mexican state of Sonora where he was arrested. It lies southeast of the border crossing nearest Nogales, Arizona.

Villegas-Hernandez has dual citizenship in the United States and Mexico, which means he can't be deported and is subject to Mexico's often-lengthy extradition process, said Victor Felix, of Sonora state police.

Roswell police hadn't released a possible motive as of Monday, saying determining that factor remained a part of the investigation.

During his years in Roswell, Villegas-Hernandez had little — if any — contact with police, said Todd Wildermuth, a spokesman for Roswell police.

Authorities had launched a search for the suspect early Sunday after relatives who stopped at the family's house late Saturday called authorities. One of the relatives saw the body of a victim through a partially open window.

After officers arrived, they reportedly discovered the victims in three different bedrooms of the house, Wildermuth said.

By Sunday afternoon, Sonora state police in Mexico alerted local authorities in Roswell that they believed they had apprehended the suspect.

Officers had gone to Villegas-Hernandez's family home in Arizpe and found his vehicle parked outside, Felix said.

When the suspect realized police were present, he fled in a vehicle, then bailed out and ran.

"It's a hilly area and he fled into the hills on foot," Felix said. "When police surrounded him, he took out a knife and said he was going to kill himself."

The officers managed to take him into custody — "it was a process of negotiation," Felix said — and are now holding him under arrest at a local hospital.

Felix said Villegas-Hernandez is being held on a misdemeanor charge equivalent to fleeing from police, and that Mexican authorities can hold him for only 36 hours.

The U.S. Marshals Service is assisting Roswell police in the process of completing paperwork to extradite Villegas-Hernandez back to New Mexico.

He has been charged in state district court with five counts of first-degree in the deaths of his wife and their daughters Yamilen, Cynthia Janeth, Abby and Ida. Roswell police initially gave different spellings of three of the children's names.

It was not immediately known whether he had a lawyer in New Mexico.