CAIRO — A popular teacher from Austin who described himself on Twitter as “Libya’s best friend” was gunned down while jogging in Benghazi on Thursday, raising fears that foreigners are among those being targeted in the surge of assassinations in the restive city.Ronnie Smith, 33, who described himself online as a Texas native, was a chemistry teacher at Benghazi’s International School and had lived in the city for 18 months. He died not far from the U.S. special mission site and CIA compound, where attackers killed Ambassador Christopher Stevens and three other Americans on Sept. 11, 2012.Since then, foreigners have been scarce in Benghazi, Libya’s second-largest city, as militias that helped topple Moammar Gadhafi have battled government forces for control. Militias dominate the city, and they have said that Westerners, whom they accuse of threatening their Islamist vision for Libya, are among their top targets. Besides the United States, Great Britain and Italy have closed their diplomatic missions in Benghazi.But it isn’t clear that the militias have the backing of Benghazi residents. Smith seemed to be particularly popular not only with students but also with liberal groups, who said they knew him personally.On Twitter, his students created two hashtags, #ThankYouSmith and #MrSmithMemories to remember their teacher.“#ThankYouSmith for everything, for risking your life everyday by being here. your presence in school will be missed,” wrote one student, yzentani.“You taught me to think like the electron and be the electron,” said another, who identified himself as Rahman Bader.“He once told me he would stay in Libya even if he had no job. He was here for the experience. There is no better man,” posted criminimed.Smith “was doing his morning exercise when gunmen just shot him. I don’t know why. He was so sweet with everyone,” Adel al Mansouri, the school’s director, told the Reuters news service. The school confirmed Smith’s death.The Libya Herald website quoted Mansouri as saying that Smith’s wife had recently returned to the United States and that he had been expected to join her over the holidays.Pictures circulated on a Facebook page of the group Libya Today that purported to show Smith after he’d been shot, lying facedown in the street. He was wearing navy jogging shorts, a gray sweatshirt and headphones. It was unclear who’d taken the photo.The U.S. government confirmed that an American had been killed but didn’t release Smith’s name and offered no information about the circumstances of the death. “We offer our condolences to the victim’s loved one,” State Department spokeswoman Marie Harf said.No one claimed responsibility for the shooting. The U.S. Embassy in Tripoli, Libya’s capital, had no comment.Since Stevens’ death last year, militias and insurgent groups, led by the extremist group Ansar al Shariah, have increased their hold on Benghazi, assassinating police officers, government officials and those thought to support Libya’s nascent government.Ansar al Shariah spokesman Mohammed al Baraasy told Libyan television last month that civilians weren’t being targeted in the assassination campaign. But in October, Islamists called for the kidnapping of Americans after U.S. troops snatched a suspected al Qaeda member, Abu Anas al Libi, in front of his house in Tripoli. He was later taken to New York to stand trial on charges stemming from the 1998 bombings of U.S. embassies in Kenya and Tanzania.In recent weeks, the Libyan government increased its forces in Benghazi after insurgents killed seven troops and two civilians in a street battle. While the government boasted then that the militias had fled, residents recently told McClatchy that they were simply lying low, waiting to strike again. Despite that increased presence, three Libyan soldiers were assassinated Thursday alone.Aware of the risksSmith was apparently aware of the risk he might face as an American living in Benghazi. But he seemed to take the threat lightly in a Nov. 5 tweet: “I understand I teach at a school of rich kids, so if (and when) I’m kidnapped by Ansar Al-Sharia, who’s gonna pay the ransom?”According to his Twitter account, Smith was married and had a toddler son. A fan of Steve Jobs, American movies and interacting with Libyans, he posted often about homesickness, his students and life in Benghazi. On Nov. 30, he posted, “It’s official: I miss my wife.” On Nov. 16, he posted a photo from his wedding, saying: “16 years with my besty.”Smith earned a master’s degree in chemistry from the University of Texas in 2006 and served at the Austin Stone Community Church.Smith has been listed as a staff member and deacon at Austin Stone. He was described as being passionate about his convictions and sharing his religion and beliefs with others.The church website says Smith was married, had three sisters and was originally from Warren, Mich. Smith and his wife, Anita, married 10 years ago in May, the website says.“When Ronnie isn’t creating new chemical compounds, he loves to read and play as many sports and possible, especially tennis,” the church website says.Smith moved to Benghazi with his family to teach high school chemistry and planned to spend time in Austin before Christmas, according to a statement from Austin Stone on Thursday afternoon. This report includes material from the Austin American-Statesman.