A Letter of Marque...
As defined by Wikipedia...
"In the days of fighting sail, a letter of marque and reprisal was a government license authorizing a person (known as a privateer) to attack and capture enemy vessels and bring them before admiralty courts for condemnation and sale. Cruising for prizes with a letter of marque was considered an honorable calling combining patriotism and profit, in contrast to unlicensed piracy, which was universally reviled."
"Historically, the distinction between a privateer and a pirate has been, practically speaking, vague, often depending on the source as to which label was correct in a particular circumstance. The actual work of a pirate and a privateer is generally the same (raiding and plundering ships); it is, therefore, the authorization and perceived legality of the actions that form the distinction. At various times, governments indiscriminately granted authorization for privateering to a variety of ships, so much so that would-be pirates could easily operate under a veil of legitimacy."