The frigate recommissioned on 14 August 1802, Captain James Barron in command. The small Moorish kingdoms on the Barbary Coast of North Africa were attacking American ships, killing and imprisoning crewmen and stealing cargo, while demanding high monetary tribute as their price for ending these piratical acts. In response to this challenge, Thomas Jefferson sent a naval squadron to the Mediterranean in May 1801 to protect the nation's interests, and on 14 November 1802, New York sailed from Washington Navy Yard to reinforce that squadron and join in the blockade. Arriving Gibraltar 6 April 1803, she met the squadron there and became its flagship when Commodore Morris, her first captain, broke his broad pennant from the frigate's yardarm. The squadron sailed on 11 April for Tripoli to confront the Pasha with a strong show of American force. En route on 25 April, a powder explosion on board New York killed four men and damaged the ship, forcing the squadron to put into Malta from 1–19 May while she effected repairs. Arriving off Tripoli on the 22nd, the squadron remained there attempting negotiations with the Bashaw. Following two brief engagements, 22 and 27 May in which the American ships’ overwhelming fire drove off attacking Tripolitan gunboats, the talks seemed to bear fruit. Midshipman John Downes was one of those recognized for distinguished service on New York during the fighting. On 9 June, a tentative treaty was agreed to on the condition that the U.S. ships would immediately leave the harbor. Commodore Morris, following these terms, sailed in New York the next day, leaving the rest of the squadron on guard off the coast to follow later, little realizing that the treacherous Bashaw would resume his piratical activities as soon as the American presence was gone. Toward home Sailing to Malta 14 June, New York received the 17-gun salute of Vice Admiral Horatio Nelson and the British Fleet at Valletta. The frigate remained there replenishing and allowing her crew to see the sights of the island until sailing for Gibraltar on 8 July by way of Naples and Málaga and arriving on 14 September. There, she met Commodore Edward Preble and his squadron, sent to relieve Commodore Morris. On the day of her arrival, Captain John Rodgers came aboard to relieve Commodore Morris of command of New York and following one month in port, the warship sailed for home. Stopping at Tunis