The United States had decommissioned its last warship from the Continental Navy, the frigate Alliance, in 1785 leaving the new country with no means to defend its own merchant shipping. Seizure of American merchant vessels and ransoming of their crews by the Barbary States proved to be the last straw. In March 1794, Congress authorized construction of six new frigates in response. When this conflict abated as a result of a Treaty of Tripoli in 1796 , funding was curtailed and construction dragged on.
However, when depredations by the French rose to an unacceptable level in 1798, Congress finally saw fit to create the Navy Department and to fund completion of the frigates and supplementary purchases of privately held vessels. So it was that a fledgling, ocean-going U.S. Navy finally put to sea and went to war. Its ships were authorized to seize French privateers and warships and claim them as prizes or war.
War? Yes. With France? Yes. Weren’t we allies against the British 15 years earlier? Yes. How can that be?
The first ship to sail was the sloop-of-war U.S.S. Ganges, which departed Philadelphia on May xx, 1798, Capt. Richard Dale in command.
 The legislation funding the frigates contained a section revoking the law if a peace treaty was signed.