HOUSTON — From his perch in hide-outs above battle-scarred Iraq, Chris Kyle earned a reputation as one of America’s deadliest military snipers. The Pentagon said his skills with a rifle so terrorized Iraqi insurgents during his four tours of duty that they nicknamed him the “Devil of Ramadi” and put a bounty on his head.

The insurgents never collected, and he returned home to become a best-selling author and a mentor to other veterans, sometimes taking them shooting at a gun range near his Texas home as a kind of therapy to salve battlefield scars, friends said. One such veteran was Eddie Ray Routh, a 25-year-old Marine who had served tours in Iraq and Haiti.

But on Saturday, far from a war zone, Mr. Routh turned on Mr. Kyle, 38, and a second man, Chad Littlefield, 35, shortly after they arrived at an exclusive shooting range near Glen Rose, Tex., about 50 miles southwest of Fort Worth, law enforcement authorities said Sunday. The officials said that for reasons that were still unclear, Mr. Routh shot and killed both men with a semiautomatic handgun before fleeing in a pickup truck belonging to Mr. Kyle.

“Chad and Chris had taken a veteran out to shoot to try to help him,” said Travis Cox, a friend of Mr. Kyle’s. “And they were killed.”

Mr. Routh was captured a few hours later near his home in Lancaster, a southern Dallas suburb, following a brief pursuit. He will be charged with two counts of capital murder, law enforcement officials said.

Friends of Mr. Kyle’s said he had been well acquainted with the difficulties soldiers face returning to civilian life, and had devoted much of his time since retiring in 2009 to helping fellow soldiers overcome the traumas of war.

“He served this country with extreme honor, but came home and was a servant leader in helping his brothers and sisters dealing with post-traumatic stress disorder,” said Mr. Cox, also a former military sniper. “Everyone has their own inner struggles, but he was very proactive about the things he was dealing with.”

In 2011, Mr. Kyle created the Fitco Cares Foundation to provide veterans with exercise equipment and counseling. He believed that exercise and the camaraderie of fellow veterans could help former soldiers ease into civilian life.

Mr. Kyle, who lived outside of Dallas with his wife and their two children, had his own difficulties adjusting after retiring from the Navy SEALs. He was deployed in Iraq during the worst years of the insurgency, perched in or on top of bombed-out apartment buildings with his .300 Winchester Magnum. His job was to provide “overwatch,” preventing enemy fighters from ambushing Marine units.

He did not think the job would be difficult, he wrote in his book, “American Sniper: The Autobiography of the Most Lethal Sniper in U.S. Military History.”

But two weeks into his time in Iraq, he found himself staring through his scope into the face of an unconventional enemy. A woman with a child standing close by had pulled a grenade from beneath her clothes as several Marines approached. He hesitated, he wrote, then shot.

“It was my duty to shoot, and I don’t regret it,” he wrote. “My shots saved several Americans, whose lives were clearly worth more than that woman’s twisted soul.”

Over time, his hesitation diminished and he became proficient at his job, credited with more than 150 kills. In his book, he describes shooting a fighter wielding a rocket launcher 2,100 yards away, a very long distance for a sniper and his farthest ever.

“Maybe the way I jerked the trigger to the right adjusted for the wind,” he wrote. “Maybe gravity shifted and put that bullet right where it had to be.”

“Whatever, I watched through my scope as the shot hit the Iraqi, who tumbled over the wall to the ground.”

An error has occurred. Please try again later.

You are already subscribed to this email.

Sheriff Tommy Bryant of Erath County said investigators were still sorting out how the three men had known one another and for how long, though he said Mr. Kyle and Mr. Littlefield had been friends. The authorities said the Saturday trip was the first time the three men had been out together at that shooting range. They said they did not know the motive for the killings.

“The suspect’s mother was a schoolteacher for a long time,” the sheriff said. “She may have reached out to Mr. Kyle to try and help her son. We kind of have an idea that maybe that’s why they were at the range, for some type of therapy that Mr. Kyle assists people with.”

In a news conference, the sheriff said: “They all went out there together in the same vehicle. The suspect may have been suffering from some kind of mental illness from being in the military.”

Pentagon records show that Mr. Routh is currently a member of the Marine Reserves. He was an expert marksman and Marine corporal who had earned several medals, including a Marine good-conduct medal. He served in Iraq from September 2007 to March 2008, Pentagon officials said, and was currently listed as “individual ready reserve,” meaning he could be called back to active duty.

Sheriff’s investigators said Mr. Routh was unemployed and since leaving active military duty had at least one arrest on a charge of driving while intoxicated.

Mr. Kyle’s autobiography was published in January 2012 and became a nonfiction best seller. It turned Mr. Kyle into a celebrity, appearing on talk shows like “Late Night With Conan O’Brien.”

The sudden success of the book surprised no one more than Mr. Kyle, the son of a church deacon who was initially rejected by the Navy when he tried to join in the mid-1990s, because of pins in his arm from a rodeo injury. His first book signing drew 1,200 people. About 850,000 print and e-book editions were sold.

In an interview with The New York Times in March, Mr. Kyle — who received two Silver Stars and five Bronze Stars for Valor — said he had hesitated to write about his experiences. But he was persuaded to move forward after hearing that other books about members of the SEALs were in the works.

“I wanted to tell my story as a SEAL,” he said. “This is about all the hardships that everybody has to go through to get the respect and the honor.”

But he also wanted his sense of humor to come out, he said, noting that he tried to “write in a Texas drawl.”

At a book signing in Kerrville, Tex., last year, Bairbre Bible, a local resident, said Mr. Kyle took a break from signing autographs to share a hug and comforting words with her husband, Jerry, a Vietnam veteran still suffering from post-traumatic stress.

“Chris, just in that short meeting, was a very strong and compassionate person,” Ms. Bible said. “You felt a warmth and a special energy.”

In gatherings with other veterans, friends said Mr. Kyle would deflect the praise of the inevitable well-wishers and play up the achievements of his comrades.

“He wasn’t the American Sniper to all of his friends,” Mr. Cox said. “He was Chris Kyle and he was right alongside you. He was proud to be a veteran and he would do anything he could to serve veterans.”

Manny Fernandez reported from Houston, and Michael Schwirtz from New York. Julie Bosman contributed reporting from New York, and Thom Shanker from Washington.

A version of this article appears in print on February 4, 2013, on Page A1 of the New York edition with the headline: Untouchable in Iraq, Ex-Sniper Dies in a Shooting Back Home. Order Reprints|Today's Paper|Subscribe