A bomb exploded near the Moroccan embassy in Libya's capital city of Tripoli, causing significant damage to the compound, security sources said on Monday.
The blast took place on Sunday night, Xinhua news agency reported.
The bomb was believed to be planted in a car parked in front of the embassy and the blast severely damaged the building, an officer said.
No casualties were reported.
Affiliates of the Islamic State (IS) terrorist group have claimed responsibility for the attack in several online posts.
The bombing came just hours after militants attacked the South Korean embassy in Tripoli, killing two guards and injuring one. There were no casualties reported among South Korean nationals.
Several embassies, including those of Egypt and the United Arab Emirates (UAE), have been targeted by militants in similar attacks.