After the Battle of Munda, the badly wounded Pompeius fled to Carteia. The town was already embroiled in factional strife between local Pompeians and Caesarians, however, with the latter eventually launching a revolt, during which Gnaeus Pompeius was again wounded. The situation quickly turned against the Pompeians, whereupon they decided to board their remaining navy of twenty ships and escape to the sea. The Caesarian naval commander Gaius Didius, who was stationed at Gades, heard of the Pompeians' escape, and promptly set off in pursuit. Having left Carteia in great haste, Pompeius' men had not brought enough drinking water and thus were soon forced to land, allowing Didius to catch up with them after four days of sailing. The Caesarians attacked the Pompeian fleet at anchor, capturing some vessels and burning the rest, consequently trapping Pompeius and his followers in southern Spain.