DES MOINES — For law enforcement officers here, it feels like a still-raw wound being torn open anew. Less than eight months after a drunken driver killed two police officers in a fiery crash, two other officers were shot to death in separate episodes on Wednesday.

Scott M. Greene, 46, an Iowa man with a history of personal problems and clashes with the police, was charged on Thursday with two counts of first-degree murder in the fatal shootings of Anthony Beminio, a Des Moines police sergeant, and Justin Martin, an officer in an adjacent city, Urbandale. On Wednesday, officers searching a rural area west of Des Moines found Mr. Greene’s abandoned truck, and the rifle they believe was used in the shootings.

Sergeant Beminio, 39, was well-known and liked within the Des Moines Police Department, which he joined in 2005, where he worked as a school resource officer and a detective, officials said. His voice choked with emotion, Sgt. Paul Parizek, a department spokesman, said, “We lost a great friend and one of our family members.”

Sergeant Beminio, who was married and had three children, was a state champion wrestler and football lineman at West High School in Iowa City. Dan Dvorak, who was an assistant football coach there, remembered him as the kind of positive influence that coaches treasure.

“At the end of his junior season, we got beaten in the playoffs, we were pretty dejected,” he said, but Sergeant Beminio’s reaction was, “Coach, can we start lifting tomorrow?”

Officer Martin, 24, attended high school in Rockwell City, and had joined the Urbandale police department just last year. He and Sergeant Beminio had graduated from Simpson College in Indianola, near Des Moines.

“He’s exactly the sort of person that you would hope would go into police work,” Dr. Jones said. “He was gentle and kind and compassionate, very intelligent, thoughtful.”

“Always, from Day 1 the day he walked in the door here at Simpson, he wanted to be a police officer,” Dr. Jones said.

The fatal shootings struck a law enforcement community still recovering from the deaths in March of Officers Carlos Puente-Morales and Susan Farrell. A drunken driver going the wrong way on Interstate 80 struck them head-on, killing himself, the two officers, and the prisoner they were transporting.

Until that crash, it had been eight years since a Des Moines officer had died in the line of duty, and nearly 39 years since one had been killed by another person. The department had never lost two officers in a single day. The Urbandale police department said that, before Wednesday, they had never had an officer killed on duty.

Emotions over “losing Carlos and Susan” are still vivid, Sergeant Parizek said, and, this time, the grief is mixed with another emotion. “Fair to say we’re all pretty angry right now.”

Police Chief Dana Wingert made that clear at a news conference, calling the gunman “this monster,” whose crime “was cowardly in every sense of the word.”

“What happened yesterday was calculated murder of two law enforcement officers, plain and simple,” Chief Wingert said. “Tony and Justin did not deserve this. The Des Moines Police Department and Urbandale Police Department did not deserve this. The communities they served did not deserve this.”

Des Moines officials said the police department had a robust peer-to-peer counseling program, which would be tested again.

“I always stand in amazement, thinking how do these guys come back to work the next day,” Mayor Frank Cownie of Des Moines said. “This is not something that the city of Des Moines has dealt with, where someone decides to go shoot a couple of public safety officers.”

Residents have responded, as they did after the crash in March, leaving flowers and gifts outside the cities’ police stations, making food deliveries, and raising money for the officers’ families.

The officers were killed between 1 and 1:30 a.m. Wednesday, about two miles apart, while sitting in their patrol cars. Officials said they believed the gunman had no interaction with either of the officers before opening fire.

Mr. Greene, the accused gunman, who lives in Urbandale, surrendered later Wednesday morning in rural Dallas County, and it was there that investigators found his truck, bogged down in brush and mud, and, separately, a .223-caliber rifle.

An explosive-sniffing dog “was able to track that gun down in a place where no person would have found it,” Sergeant Parizek said. “It was hidden very well.”

No permit is required to own a rifle in Iowa, but under state law, carrying a loaded gun in any city generally does require a permit. Polk County, which includes Des Moines and Urbandale, said it had not issued a carry permit to Mr. Greene, but another Iowa county might have done so.

When he turned himself in, Mr. Greene complained of a medical problem and was taken to a hospital, where he remained until being taken to jail on Thursday. Until then, detectives had not questioned him, and it was unclear if they were able to speak with him after he left the hospital. Sergeant Parizek said that no motive for the shootings was known.

“I guarantee whatever it is, it’s not going to make any damn sense to any of us,” he said.

Mitch Smith reported from Des Moines and Richard Pérez-Peña from New York.

A version of this article appears in print on , on Page A23 of the New York edition with the headline: For Des Moines Police, Raw Feeling of Loss Is Renewed. Order Reprints | Today’s Paper | Subscribe