Marghani said before leaving he tried to talk to the 20 to 30 militants who arrived at the ministry in trucks with anti-aircraft guns mounted on top, CNN reported.
Libya's Foreign Ministry remains under siege by militants for the third straight day.
Armed protesters have said their goal is to force the General National Congress to pass a law banning Gadhafi-era officials from holding government posts.
Eighteen months after the fall of the regime armed groups continue to threaten the county.
Last month protesters occupied the General National Congress for several hours in an attempt to force members to pass a political isolation law.