When the United States refuses to pay tribute to the North African Barbary pirates, who have been raiding its ships in the Mediterranean, the pasha of Tripoli declares war on the United States. President Thomas Jefferson exerts his powers as commander in chief to set a naval blockade of Tripoli that results in a peace treaty in 1805.