A group of armed gunmen attacked the South Korean embassy in Tripoli on Sunday, killing two Libyan guards and injuring another officer, Foreign Ministry officials said.
The incident took place at around 1:20 a.m. Libyan time when the assailants fired some 40 shots from a machine gun as they drove by the embassy, an official said.
The Islamic State militant group claimed responsibility about two hours later on Twitter, saying it had "removed" two guards at the facility.
The three officers who were affiliated with Libya's Interior Ministry were sent to a nearby hospital by local residents, but two later died.
The ministry temporarily relocated its embassy to Tunis last year due to growing security concerns. Two Korean diplomats, who are assigned to move between the two cities for two weeks in turn, and one assistant serving at the embassy were unharmed, the official said, adding it is considering a complete withdrawal from the conflict-ridden country.
The compound is protected by about 20 special security forces, in line with the embassy's request.
"We do not know if those in the vehicle targeted the embassy or the police officers there, but other than on the exterior walls, there is no damage inside, including to our diplomats and administrative officer," he told reporters on condition of anonymity.
"The local police immediately opened a probe, which is still underway. Embassy officials phoned the police chief to call for a thorough and swift investigation, as well as an increase in security personnel."
The unprecedented attack is set to heighten further safety concerns in the Middle East that prompted Seoul to impose a travel ban in five countries ― Libya, Syria, Iraq, Yemen and Afghanistan.
With infighting stoking instability since the 2011 death of longtime ruler Muammar Gaddafi, the diplomatic missions of other countries in the region have also been attacked by armed gunmen in recent years, including those of the US, the United Arab Emirates and Egypt.
In January, a Korean teenager went missing in Turkey after taking a route that locals say is typically chosen by aspiring IS jihadists to sneak into Syria. The National Intelligence Service said in February that the 18-year-old man was training to become a member of the extremist group.