Two of the four Americans killed Tuesday after an attack on the U.S. consulate in Libya were former Navy SEALs from San Diego County.

Glen Doherty, 42, of Encinitas, and Tyrone Woods, 41, of Imperial Beach, were working at the diplomatic compound in Benghazi as security and intelligence contractors. Also killed were the U.S. ambassador to Libya, Chris Stevens, and information officer Sean Smith. Three others were wounded.

Secretary of State Hillary Clinton said Thursday that Doherty and Woods “died helping protect their colleagues.

“Our thoughts, prayers, and deepest gratitude are with their families and friends. Our embassies could not carry on our critical work around the world without the service and sacrifice of brave people like Tyrone and Glen,” she said in a statement.

The two former SEALs settled in San Diego County after initial training in Coronado, where all the elite naval special operators must pass a grueling 21-week test of mental and physical endurance.

Doherty, who grew up in the Boston suburb of Winchester, Mass., was a gregarious outdoorsman and high-octane adventurer, a self-proclaimed “high priest” of “The Cult of Recreationalism,” friends and family said.

The pilot, former ski instructor, surfer and trainer at the CrossFit/SEALFIT gym in Encinitas served nine years as a SEAL before getting out in 2005.

“Glen was a true hero and one of the greatest guys I’ve ever known. You would have liked him,” said Brandon Webb, a former Navy SEAL from San Diego who wrote a book with Doherty called “Navy SEAL Sniper.”

Almost everyone did, according to Doherty’s family and friends. “His way of making everyone around him feel special and loved came from the fact that he genuinely looked up to all his friends, always seeing their greatness in a way they sometimes wished they could see themselves,” his brother, Greg Doherty, of Kensington, said in a statement.

Glen Doherty’s ex-wife, Sonja Johnson, said “People looked up to him. ... They were inspired by him. He was always a leader. He could command attention.” He was also a dependable friend, she added: “He’s the guy you’d call who you knew would help you move, lend a hand or take care of your dog. He would never say no.”

During his military career, Doherty graduated from the 18 Delta Special Forces Combat Medical School and the SEAL sniper course. He responded to the USS Cole attack off the coast of Yemen, participated in the 2003 invasion of Iraq and served a second tour there in 2004.

“He simply believed that the possibility of liberating the country from a tyrant and making democracy possible for the Iraqi people was worth him risking his own life for,” Greg Doherty said.

Glen Doherty’s work as a government contractor took him for months at a time to countries including Lebanon, Pakistan and Afghanistan. The work was an extension of his military service, said one acquaintance who asked not to be named out of respect for the privacy of special operations forces.

“You never take your uniform off. You hang it in the closet. But everything that went along with it is still there. All the training and the dedication you have to your nation. That is what drives these guys,” he said.

Word of the former SEALs’ deaths was a deep blow that spread nationwide in special operations forces circles. Mike Ritland, a friend of Doherty and former Navy SEAL, said in a statement: “The loss of this incredible warrior is one that will forever hurt this nation’s heart. … The brotherhood mourns the loss of one of its very best. Fair winds and following seas brother, we will see you on the other side.”

Woods, a former owner of The Salty Frog bar in Imperial Beach, served more than 20 years as a SEAL and deployed multiple times to Iraq and Afghanistan. He is survived by his wife Dorothy, two teenaged sons, Tyrone Jr. and Hunter, and infant Kai.

His former wife, Patricia Ann So, described him as talented, highly skilled and dedicated. “He was balls to the wall,” she said. “He loved life, loved adrenalin.”

Woods went through Hell Week — the grueling 5½-day make-or-break culmination of initial SEAL training — twice, So said. She was certain that he died doing what he loved to do.

Manuel Santana, a former neighbor, said Woods was a quiet and good man who didn’t go looking for trouble. But “he was tough. He was the type of person you didn’t want to tangle with on a dark street at night,” Santana said.

Before he moved out of the neighborhood a few months ago, Woods used to drink coffee daily when he was in town at an ice cream shop and café called Cow A Bunga. “He was very secretive because of his job, so we never knew what he was doing. All we knew was that he was working to defend his country because he loved it,” said Fabrice Gaunin, one of the owners.

“If there were more people like him, this country would be in much better shape. We need people to keep doing what he was doing. Because he really believed in freedom and he really believed in the U.S.”

Islamist militants are suspected of using a protest over an inflammatory movie as cover for a coordinated assault on the diplomatic post on the anniversary of the Sept. 11 terrorist attacks, U.S. and Libyan government officials said.

The four-hour assault Tuesday night in Benghazi included rocket-propelled grenade attacks on the consulate and a nearby annex or safe house.

Doherty’s sister, Kate Quigley, told The Boston Globe that she did not believe the attack was a spontaneous protest against the movie clip aired on YouTube that ridiculed the Muslim Prophet Muhammad.

“I never thought he’d be another victim of Sept. 11,” Quigley said. “You have to understand. Glen was highly trained. He was the best of the best. He wouldn’t have gone down for some protest over a movie.”

As the mob of some 200 people threatened to storm the consulate, military and security personnel inside would have been under the operational control of the U.S. State Department and diplomatic staff on hand, said John Valdez, 75, of Oceanside, who served three tours as a Marine security guard protecting U.S. embassy staff abroad before he retired in 1985.

They would be under orders to hold their fire until the ambassador or charge d’affaires gave the command, he said.

“When it comes to the nitty gritty, the ambassador is the one who makes the call,” he said. “Nine times out of 10 they will not tell anybody to fire. You can’t do anything pretty much. Unless it becomes imminent and you are fearing for your life, then you might decide to fire (anyway) and suffer the consequences.”

Those who knew the former SEALs said they had no doubt they went down fighting.

“Don’t cry for Glen, he would not approve. Celebrate a man who lived well and died with a gun is his hands, fighting for those too weak to fight for themselves,” said a friend and former SEAL who identified himself as “SH9.”