A suicide bomber was killed and two security men injured during an explosion near the US consulate in Jeddah, Saudi Arabia.

The attacker approached the area close to the consulate in the early hours of America’s Independence Day and before the start of dawn prayers at around 2:15am, parking his car outside a hospital.

Two security guards became suspicious of the man and approached him outside the Dr Suleiman Faqeeh hospital, situated opposite the consulate, an interior ministry spokesperson said in a statement.

The man “blew himself up with a suicide belt inside the hospital parking,” according to the statement, lightly wounding the two security guards.

The ministry did not say if the attacker was intending to target the consulate but said an investigation into the man’s identity is underway.

State TV said this is the first bombing in years attempting to target foreigners in Saudi Arabia. A witness told Reuters news agency that three further blasts were later heard in the area after police carried out what are understood to have been controlled explosions near the site.

A video sent to the agency by the witness showed police taking cover behind vehicles as the blasts happened. The witness also claimed the explosion appeared to have taken place 20m from an outer checkpoint of the consulate, which had been closed off by security forces as helicopters flew over the area.

Saudi's Deputy Crown Prince Mohammed bin Salman on key visit to US

The US consulate issued a statement to confirm there had been no casualties or injuries among staff.

The statement added that the consulate and the US embassy were in contact with Saudi authorities investigating the incident.

US citizens in Saudi Arabia received a message from the State Department reminding them to stay aware of their surroundings and to take extra precautions when travelling.

A 2004 al Qaida-linked militant attack on the US consulate in Jeddah killed five locally-hired consular employees and four gunmen. The three-hour battle on the compound came amid a wave of al Qaida attacks targeting Westerners and Saudi security posts.

More recently, Saudi Arabia has been a target of Islamic State group attacks that have killed dozens of people.

The extremist group views the Western-allied Saudi monarchy and government as heretics. Saudi Arabia is part of the US-led coalition fighting IS in Iraq and Syria.