By the eighteenth century, the UK had established itself as the world's preeminent naval power. Attempts by Napoleon to challenge the Royal Navy's dominance at sea proved a colossal failure. During the Napoleonic Wars, Britain defeated French and allied fleets decisively all over the world including in the Caribbean at the Battle of Cape St Vincent, the Bay of Aboukir off the Egyptian coast at the Battle of the Nile in 1798, near Spain at the Battle of Trafalgar in 1805, and in the second Battle of Copenhagen (1807). The UK emerged from the Napoleonic Wars in 1815 with the largest and most professional navy in the world, composed of hundreds of wooden, sail-powered ships of all sizes and classes.