By Charlene Gubash, Alexander Smith and Henry Austin, NBC News

(NBC) - A beloved American teacher was shot dead in the Libyan city of Benghazi on Thursday, just days before he was supposed to return to the U.S. for the holidays, the school's principal said.

Ronnie Smith, 33, had been teaching chemistry at the International School Benghazi for about 18 months and was "very much loved," principal Peter Hodge told NBC News.

"He was the most amazing person, more like a best friend or a family member," said student Yomna Zentani, 18.

"After everything that happened in Libya, we were losing hope and he was the only one who was supporting us, motivating us, telling us that as long as we studied everything would be okay. He was the silver lining.

"He dedicated so much of his time for all his students," she added. "He chose to come here and help us and risk his life."

Smith began working at the school after a stint in Egypt, she said.

"He was going back home to see his mom and his family where he hadn't been for some time. He was supposed to leave this week but he said he would stay around for our midterms and sent his family. He was going to join them."

Lujain Beruwien, 16, said Smith had helped her get settled in Benghazi when her Libyan parents moved back from Scotland.

"Because I'm from the U.K. and he's from America we were always trying to outdo each other," she said. "It's really upsetting that he has died. The majority of Libyans want the country to develop but the others are just trying to ruin things for everyone. We're not going to stand for this."

Adel Mansour, a former principal at the school who is currently head of its board of governors, described Smith as a "great guy."

"He loved being in Benghazi and he loved Libya and the kindness of its people," Mansour told NBC News. "He was looking forward to going back and being with his family [to the U.S. for Christmas] but unfortunately now that's not going to

Security official Ibrahim al-Sharaa told The Associated Press that the victim was jogging near the U.S. Consulate at the time of the shooting. NBC News was unable to independently confirm that account.

A State Department spokeswoman confirmed the death of an American and said authorities were in touch with his family but declined further comment.

Benghazi, Libya's second-largest city, became a political flashpoint following the Sept. 11, 2012 attack targeting the U.S. Consulate which left Ambassador Chris Stevens and three other Americans dead. A hardline Islamist group known as Ansar al-Shariah has been blamed.

Two years after the NATO-backed uprising that ousted Moammar Gadhafi, Libya is still in messy transition, with no new constitution, a temporary government and nascent security forces struggling to contain militias and former rebels.

In October, Islamist militants called for the kidnapping of U.S. citizens in Libya and targeted attacks on American property following a raid by U.S. special forces to seize a suspected al Qaeda leader from his home in Tripoli.

Last week, Libya's army clashed with militants in Benghazi, where Islamists run their own checkpoints in the port city and assassinations and bombings happen regularly.

At least nine people died when fighting broke out between army special forces and members of Ansar al-Shariah.

Oil workers, civil servants and private sector staff later went on a three-day strike in the port city, protesting against the deteriorating security situation.

The mass walkout was the latest sign of growing anger against militias who helped oust Gadhafi. Most groups have kept their weapons and regularly challenge the fragile new government and its security forces.

Most countries closed their consulates in Benghazi after a series of attacks and some foreign airlines have stopped flying there.

In the wake of recent clashes in Tripoli which left more than 40 people dead, Secretary of State John Kerry last month urged Libyans to "break the cycle of violence through respectful dialogue and reconciliation."

He added: "Too much blood has been spilled and too many lives sacrificed to go backwards."