It is not to be supposed that Yusuf took all these pains merely to establish his brother quietly in Tripoli; the rude soldiery who decide matters of that kind in Barbary, could not but see a difference between him and Hamet, which was by no means in favor of the latter. Of this disposition Yusuf took full advantage, and so ingratiated himself with the troops, that when at length the news of old Ali's death reached the city, he was unanimously proclaimed Pasha; his brother, who was absent at the time, on returning, found the gates closed against him, and received an order from the new sovereign to retire to the distant province of Derne, and remain there as Bey. Hamet having no other resource, went to his place of banishment, and remained there for some time; but finding that his brother was daily making attempts to destroy him, he at length in 1797 retired to Tunis, where he was supported by the Bey.

The earliest act of Yusuf with regard to foreign intercourse, was the conclusion of a treaty with the United States, which was signed on the 4th of November, 1796, Joel Barlow then American Consul at Algiers and Colonel David Humphries, being the agents of the latter party. Its terms are generally reciprocal; passports are to be given to vessels of each country by which they are to be known—"As the Government of the United States is not in any sense founded on the christian religion, and has in itself no character of enmity against the laws, religion or tranquillity of Mussulmen, no pretext arising from religious opinions shall ever produce an interruption of the harmony between the two countries"—the Pasha acknowledges the receipt of money and presents, "in consideration for this treaty of perpetual peace and friendship, and no pretence of any periodical tribute or farther payment is ever to be made by either party." Finally, the observance of the treaty is "guarantied by the most potent Dey and Regency of Algiers, and in case of dispute, no appeal shall be made to arms, but an amicable reference shall be made to the mutual friend of both parties, the Dey of Algiers, the parties hereby engaging to abide by his decision."

To the terms of this treaty it would be difficult to offer any objection; the United States were anxious that their commerce in the Mediterranean should be undisturbed; their naval force was inadequate to its protection, and it was then considered inexpedient to increase that force. Presents were given in compliance with a custom generally if not always observed, and it was certainly the more manly course to have the fact openly stated in the treaty, with the proviso annexed, that none others were to be expected. The treaty between the United States and Algiers was on terms less equal, as it contained a stipulation on the part of the former to pay an annual value of twenty-one thousand dollars in military stores.

Thus secured from interruption, the American commerce in the Mediterranean rapidly increased, and the Tripoline corsairs were daily tantalized by the sight of large vessels laden with valuable cargoes, which were to be passed untouched, for no other reason than because they sailed under the striped flag and carried a piece of parchment covered with unintelligible characters. This must have been the more vexatious to the corsairs as they never met with ships of war belonging to the nation which they were thus required to respect.

Reports of this nature did not fail to produce their effect upon Yusuf; his cupidity was excited, and he doubtless feared that his popularity might suffer, if his subjects were longer prevented from pursuing what had always been considered a lawful and honorable calling in Barbary. He had collected a small maritime force, estimated in 1800 at eleven vessels of various sizes, mounting one hundred and three guns, and thus considered himself strong enough to give up the further observance of a treaty with a power which appeared so incapable of enforcing it. In this idea he was encouraged by his naval officers. The chief of these was a Scotch renegade, who had been tempted to exchange the kirk for the mosque, and his homely name of Peter Lyle, with his humble employment of mate to a trading vessel, for the more sounding title of Morat Rais, and the substantial appointment of High Admiral of Tripoli. Rais Peter is represented by all who knew him as destitute of real talent, but possessing in its stead much of that pliability of disposition which is supposed to form an essential characteristic of his countrymen; however that may have been, he for some time enjoyed great credit with the Pasha, and employed it as far as he could against the interests of the United States. Whether this arose from any particular enmity, or from the hope of enjoying a share of the anticipated spoil, is uncertain; but to his influence was mainly ascribed the proceedings which led to a rupture of the peace. Another abettor of the war was the Vice Admiral Rais Amor Shelly, a desperate ruffian, who was most anxious to be engaged where there was such evident promise of gain. Hamet Rais, the minister of marine, was of the same opinion, and probably of all his councillors, Yusuf placed the greatest confidence in him; he is represented as a man of great sagacity and energy—such indeed, that Lord Nelson thought proper in 1798, to send a ship of the line, with a most overbearing letter, demanding his exile, which the Pasha promised, but after the departure of the ship thought no more about it. The only friend of the United States in the regency, was the Prime Minister Mahomet d'Ghies, whom every account represents as an honorable and enlightened gentleman.

Thus fortified by the assurances of his counsellors, and farther induced by his success in bringing Sweden to his terms, Yusuf commenced his proceedings against the United States in 1799, by making requisitions of their consul; these were resisted, and to a proposal from Mr. Cathcart (the consul) that reference should be made to the Dey of Algiers, as provided in such cases by the treaty, the Pasha replied that he no longer regarded the stipulations of that convention. His intentions became more clearly defined in the ensuing year, when Rais Shelly returned from a cruise, with an American brig, which he had brought in under pretence of irregularity in her papers; she was indeed restored, but not until after long delay and the commission of numberless acts of petty extortion, accompanied by hints that such lenity would not be again displayed. Considerable time having elapsed without any answer from the United States, the consul was informed that the treaty with his country was at an end; that the Pasha demanded two hundred and fifty thousand dollars as the price of a new one; and that it must contain an engagement on the part of the United States, to pay an annual tribute of twenty-five thousand dollars for its continuance. No reply having been made to this, war was formally declared by Tripoli on the 11th of May, 1801, the American flag staff was cut down by the Pasha's orders on the 14th, and Mr. Cathcart left the place a few days after.

A swarm of cruisers instantly issued from the port of Tripoli, and spread themselves over every part of the Mediterranean; two of them under Morat Rais arrived at Gibraltar, with the intention of even braving the perils of the unknown Atlantic, in search of American vessels. In the course of a few weeks five prizes were taken by the corsairs; but the consul of the United States had long foreseen the danger, and given timely warning, so that interruption of their commerce was almost the only evil afterwards suffered.

As soon as the news of these exactions arrived in Washington, President Jefferson caused a squadron, composed of three frigates and a sloop of war, to be fitted out and despatched to the Mediterranean, under Commodore Dale; it entered that sea about the end of June, 1801, and was probably the first American armed force seen in its waters. This squadron was sent with the hope that its display would be alone sufficient to bring the Pasha back to the observance of the treaty; the Commodore was therefore instructed to act with great caution, so as to repress rather than provoke hostilities; and he was made the bearer of letters to each of the Barbary sovereigns, couched in the most amicable terms and disclaiming all warlike intentions. The squadron touched first at Tunis, where its appearance somewhat softened the Bey, who had begun the same system of exactions from the American consul; it then sailed for Tripoli, before which it appeared on the 24th of July.

The sight of such a force was very disquieting to Yusuf, who sent a messenger on board to learn what were its objects. The Commodore replied by asking what were the Pasha's views in declaring war, and on what principles he expected to make peace? To this Yusuf endeavored to evade giving a direct answer, and he hinted that his principal cause of complaint was the dependence on Algiers implied by the terms of the first and the last articles of the treaty, which he considered humiliating. The American commander not being empowered to negotiate, remained for some days blockading the harbor, until having learnt that several cruisers were out, he thought proper to go in search of them. One only was encountered, a ship of fourteen guns, commanded by Rais Mahomet Sous, which after an action of three hours, on the 1st of August, with the schooner Enterprize, struck her colours; the Americans lost not a man, the Tripolines had nearly half their crew killed or wounded. As orders had been given to make no prizes, the cruiser was dismantled, and her captain directed to inform the Pasha, that such "was the only tribute he would receive from the United States." Notwithstanding the desperate valor displayed in this action by the Tripolines, Yusuf thought proper to ascribe the result to cowardice on the part of the commander; and poor Mahomet Sous, after having been paraded through the streets of the city on an ass, exposed to the insults of the mob, received five hundred strokes of the bastinado. This piece of injustice and cruelty however, produced an effect the reverse of that which was intended; for after it, no captain could be induced to put to sea, and those who were out already, on learning the treatment experienced by their comrade, took refuge from the Americans and the Pasha, for the most part among the islands of the Archipelago. The two largest vessels which had been arrested at Gibraltar on their way to the Atlantic, by the appearance of the United States' squadron, were laid up at that place, their crews passing over into Morocco.