The United States on Wednesday ordered most of its personnel to evacuate its embassy in Cairo leaving just a skeleton staff behind, only hours after the Egyptian military ousted president Mohamed Morsi.

Amid fast-moving events in Egypt, a travel advisory confirmed that "the Department of State ordered the departure of non-emergency US government personnel and family members from Egypt due to the ongoing political and social unrest."

The embassy in Egypt has occasionally been targeted by demonstrators and as protests swelled in Cairo it had already been closed on Tuesday and Wednesday as a precaution.

Due to the July 4 Independence Day holiday and the Arab world weekend, it was not due to reopen until Sunday at the earliest.

The advisory warned that "political unrest ... is likely to worsen in the near future."

The State Department advised all Americans "to defer travel to Egypt and US citizens living in Egypt to depart at this time because of the continuing political and social unrest."

An American was killed on Friday in the northern port of Alexandria during a demonstration and "Westerners and US citizens have occasionally been caught in the middle of clashes and demonstrations," the advisory warned.

It said that demonstrations had often "degenerated into violent clashes between police and protesters, and between protesters supporting different factions, resulting in deaths, injuries, and extensive property damage."

Molotov cocktails and rocks as well as tear gas and other crowd control measures were often used at demonstrations, it warned.

However the notice stressed that there were currently no plans for special charter flights or US-sponsored airlifts to evacuate Americans from the country.

"If you wish to depart Egypt, you should make plans and depart as soon as possible. The airport is open and commercial flights are still operating, although cancellations may occur."

The US also warned women in particular about rising sexual violence in the country, saying they have often been the targets of sexual assault.