Roberto Cofresí, one of the last successful Caribbean pirates, is defeated in combat and captured by authorities.

The capture of the sloop Anne was the result of a naval campaign carried out by an alliance between the Spanish Empire forces in Puerto Rico, the Danish government in Saint Thomas and the United States Navy. The powers pursued Roberto Cofres's pirate flotilla in March 1825 because of the economic losses suffered by the parties to the pirates, as well as diplomatic concerns caused by their use of the flags of Spain and Gran Colombia which menaced the fragile peace between the naval powers. Several of those involved had been attacked by the freebooters. Among the diplomatic concerns caused by Cofres was a robbery carried out by several of his subordinates, the catalyst of an incident that threatened war between Spain and the United States known as "The Foxardo Affair", eventually leading to the resignation of his rival, pirate hunter David Porter.

Sailing under the authorization of the Danish West Indies, the coalition employed two local ships, including a former victim of the pirates named San Jos y las Animas and USS Grampus of the West Indies Squadron. A ship from Gran Colombia, named La Invencible, also provided support during the initial stages. The final naval engagement took place on March 5, 1825, and began with a trap set at Boca del Infierno, a passage off Baha de Jobos, Puerto Rico. The flagship of Cofres's flotilla, the sloop Anne (otherwise known as Ana), was baited by the set up. Surprised and outnumbered, the pirates abandoned the ship and escaped to shore, where they were captured by Puerto Rican authorities and placed on military trial. With the execution of Cofres, the West Indies Anti-Piracy Operations were considered a success and he came to be known as "the last of the West India pirates".

Roberto Cofresí y Ramírez de Arellano (June 17, 1791 – March 29, 1825), better known as El Pirata Cofresí, was a pirate from Puerto Rico. He was born into a noble family, but the political and economic difficulties faced by the island as a colony of the Spanish Empire during the Latin American wars of independence meant that his household was poor. Cofresí worked at sea from an early age which familiarized him with the region's geography, but it provided only a modest salary, and he eventually decided to abandon the sailor's life and became a pirate. He had previous links to land-based criminal activities, but the reason for Cofresí's change of vocation is unknown; historians speculate that he may have worked as a privateer aboard El Scipión, a ship owned by one of his cousins.

At the height of his career, Cofresí evaded capture by vessels from Spain, Gran Colombia, the United Kingdom, Denmark, France, and the United States. He commanded several small-draft vessels, the best known a fast six-gun sloop named Anne, and he had a preference for speed and maneuverability over firepower. He manned them with small, rotating crews which most contemporaneous documents numbered at 10 to 20. He preferred to outrun his pursuers, but his flotilla engaged the West Indies Squadron twice, attacking the schooners USS Grampus and USS Beagle. Most crew members were recruited locally, although men occasionally joined them from the other Antilles, Central America, and Europe. He never confessed to murder, but he reportedly boasted about his crimes, and 300 to 400 people died as a result of his pillaging, mostly foreigners.

Cofresí proved too much for local authorities, who accepted international help to capture the pirate; Spain created an alliance with the West Indies Squadron and the Danish government of Saint Thomas. On March 5, 1825, the alliance set a trap which forced Anne into a naval battle. After 45 minutes, Cofresí abandoned his ship and escaped overland; he was recognized by a resident who ambushed and injured him. Cofresí was captured and imprisoned, making a last unsuccessful attempt to escape by trying to bribe an official with part of a hidden stash. The pirates were sent to San Juan, Puerto Rico, where a brief military tribunal found them guilty and sentenced them to death. On March 29, 1825, Cofresí and most of his crew were executed by firing squad.

He inspired stories and myths after his death, most emphasizing a Robin Hood-like "steal from the rich, give to the poor" philosophy which became associated with him. This portrayal has grown into legend, commonly accepted as fact in Puerto Rico and throughout the West Indies. Some of these claim that Cofresí became part of the Puerto Rican independence movement and other secessionist initiatives, including Simón Bolívar's campaign against Spain. Historical and mythical accounts of his life have inspired songs, poems, plays, books, and films. In Puerto Rico, caves, beaches, and other alleged hideouts or locations of buried treasure have been named after Cofresí, and a resort town is named for him near Puerto Plata in the Dominican Republic.