The 4th of July, U.S. Independence Day, celebrations in Saudi Arabia's Jeddah were marred by violence as a suicide bomber blew himself up outside a mosque opposite the U.S. consulate. The attacker was killed and two police officers were injured in the blast.

The blast attempt took place during the early hours of 4th of July.

State media said that the attacker parked his car near the mosque and finally blew himself up on Monday after security guards tried to approach him, Saudi Arabia's Interior Ministry said in a statement. The guards decided to approach the man as they found him behaving suspiciously, the statement said.

"All personnel under chief of mission authority are accounted for at this time," a spokesperson was quoted as saying by Al Jazeera. Most of the U.S. consulate officials have shifted offices, the Associated Press reported. 

Investigation into the blast has been initiated and the U.S. State Department is working with the Saudi authorities in finding out who perpetrated the attack. No terrorist organisation has claimed responsibility yet.

It is not yet certain if the attacker intended to target the U.S. consulate in Jeddah. 

A previous attack on the U.S. consulate in Jeddah by the al Qaeda in 2004 had killed five locally-hired consular employees and four gunmen. 

More recently, the country has been targeted by Isis as Saudi Arabia is part of a U.S.-led coalition against the terrorist group in Iraq and Syria.

There have been 26 terror attacks in Saudi Arabia since 2014, the Interior Ministry was quoted as saying by the AP. Daesh or Isis has repeatedly attacked the Shiite and other minority population in the country.