On 26 May 1778, Fanning embarked from Boston, Massachusetts aboard the brig Angelica as a prizemaster under the command of Captain William Denison in a cruise against the British. On 31 May, when the British man-of-war Andromeda captured and blew up Angelica, Fanning was among those taken prisoner. Embarked in Andromeda was General William Howe, by whose order the Americans were confined to the hold and treated severely, being allowed but a half-pint of water per day per man, even though the heat was so unbearable that the men were obliged to strip off all their clothes.
On 30 June 1778, Andromeda reached Portsmouth, England, and Fanning was incarcerated at Forton prison. On 2 July 1779, Fanning was included in a prisoner exchange. He was marched to Gosport, then taken by cartel to Nantes, France. From there, he traveled to L’Orient, where he signed on as midshipman and private secretary aboard Bonhomme Richard under John Paul Jones.
Bonhomme Richard cleared L’Orient on 14 August 1779 and over the next month captured or destroyed at least 29 enemy vessels. On 23 September 23, in the Battle off Flamborough Head against HMS Serapis, Fanning served as captain of the main top. Although most of his topmen were killed, he led a fresh party aloft and with them cleared Serapis’ tops. When their yards locked the two ships together, he led his men across to the British ship, where with hand grenades and mortars, they drove the British seamen from their stations. In recommending that Fanning be promoted, Jones said of him “. . . he was one cause among the prominent in obtaining the victory.”
Fanning continued to serve under Jones aboard his new ship Alliance and later Ariel. He then served as second-in-command aboard the privateer Count de Guichen, which sailed from Morlaix on 23 March 1781 and over the next five weeks ransomed or sank numerous enemy vessels. On 4 May, however, the privateer was captured by HMS Aurora and Fanning was again taken prisoner, to be paroled six weeks later.
On 3 December 1781, Fanning sailed from Ostend aboard Eclipse and had another productive cruise, returning to Dunkirk on 6 March 1782. While Eclipse was being refitted, Fanning made two trips to London, once as a spy and once to deliver peace proposals from the Court of France. On 6 June, Eclipse took departure for the coast of Scotland under Fanning’s command. On 11 August, pursued by Jupiter, said to be the fastest ship in the British Navy, Fanning sailed directly through the middle of the British Channel Fleet in broad daylight. To evade capture, he hoisted English colors and when hailed, answered that the ship was His Majesty’s cutter Surprise.
Two days later, while capturing Lord Howe, Fanning was wounded in the left leg by a musketball. He sailed for Dunkirk and spent several weeks recovering.
In October 1782, he was commissioned as lieutenant in the French Navy. On the 23rd, he sailed from Dunkirk in command of the privateer Ranger, but was captured by an English cutter. Fanning was promptly exchanged, but his crew members, being Irish, were all executed as traitors.
Returning to Dunkirk, Fanning set sail again on 14 November, but was captured a fourth time by the British frigate Belle Poule. Fanning was placed in chains, and abused by the crew. He was rescued when his captors’ ship was, in turn, captured by the French Navy. Learning that a peace treaty was imminent, Fanning attempted to launch yet another expedition against the British, but was unable to set sail before further privateering was prohibited.
Fanning returned to the United States and commissioned a lieutenant in the US Navy on 5 December 1804. Placed in command of Gunboat No. 1 at Charleston, South Carolina, he contracted yellow fever and died there on 30 September 1805.