Beat a hasty retreat

To retreat or withdraw very quickly.

The US soldiers beat a hasty retreat when the guerrillas attacked them.