The difficulties between Eaton and the Bey were much increased by the intrigues of the Tunisian ministers and officers; particularly by those of Sidi Yusuf, the Seid-e-Tapa, or Keeper of the Seal, commonly called the Sapatapa, a wretch who by the most infamous practices had amassed an immense fortune, and raised himself from the condition of a Georgian slave to the highest place in the ministry. To their ceaseless importunities for presents Eaton at first yielded; but finding that compliance only rendered them more frequent, and that the requests put on the form of exactions, he at length plainly refused, frequently clothing his denial in a sarcastic dress, or accompanying it by observations which no interpreter could soften into compliments. Indeed, on several occasions, when the inferior agents were insolent, he did not scruple to lay his cane over their shoulders; and even Famin the Frenchman, who had been the representative of his government in the negotiation of the treaty, felt the weight of his arm. These circumstances rendered him obnoxious to the whole Tunisian government, and every attempt was made to get rid of him, in order to obtain another consul who might be of more pliable stuff. Intimidate him they could not, but they succeeded fully in disgusting him.

Circumstances at length occurred which revived his hopes of seeing the honor of his country vindicated, and its relations with the Barbary powers established on a fair and firm basis. It has been stated that Hamet, the exiled Prince of Tripoli, had sought refuge in Tunis from the persecutions of his brother; he was there received and supported by the Bey, partly from compassion, but principally from political motives, as he might thus be employed to keep Yusuf in check. In the summer of 1801, it was suggested to Eaton by the ex-consul Cathcart, that the restoration of Hamet to the throne of Tripoli might in all probability be easily effected through the assistance of the United States, and that it would prove highly advantageous to American interests. Eaton at first paid but little attention to the suggestion; but afterwards having obtained information from Tripoli on which he could rely, that the Pasha was very unpopular, and his subjects ripe for revolt, he became acquainted with the Prince, and gradually communicated to him his views. He proposed that Hamet should proceed to Tripoli with the whole American squadron, and be there presented to the people as their rightful sovereign; if accepted, peace was to be made, on terms of which the principal were stated, one of them being the delivery of Yusuf to the Americans; if the inhabitants should however refuse to receive him, the war was to be prosecuted with vigor to a conclusion.

Hamet at first appeared to enter into the plan, and communicated information from which its success appeared still more probable; but his natural irresolution soon returned, and innumerable difficulties presented themselves to his imagination. The most serious ground of objection taken by him was, that his family were still retained as hostages in Tripoli, and the ruthlessness of his brother's character rendered it highly probable that he might exercise towards them any degree of violence, when prompted either by interest or revenge. To this, Eaton opposed the consideration, that the appearance of an overwhelming force, with the country too in arms against Yusuf, would impress upon him the inutility of resistance, and oblige him to enter into some arrangement for the release of Hamet's family, and the surrender of the throne. The exiled Prince would however make no promises, until he had been assured of the assistance of the American force, which Eaton immediately endeavored to obtain; but neither his instructions, nor those of the commander of the squadron, would warrant such proceedings; and indeed, as the proposition came from Eaton, it was of course reprobated and pronounced visionary by the latter. The consul therefore wrote to his government, detailing his plan, and urging its attention; and his health being much enfeebled, he determined to await an answer in Italy, for which country he sailed in December, 1801.

These projects could not be devised so secretly as to escape the vigilance of the Tunisian government; and they were soon communicated to Yusuf, by one of its ministers whom he kept in pay. They created in him the utmost alarm. He had just then involved himself also in a war with Sweden, and a fleet from that country had already entered the Mediterranean under Admiral Cederstrom, who had orders to act in concert with the Americans. His two largest vessels were lying useless at Gibraltar; and Morat Rais, without whom he could do little towards equipping others, was also at that place closely watched by his enemies.

In this state of things, he endeavored to amuse the Americans with propositions of peace; and the sovereigns of Algiers and Tunis being in consequence engaged by him as mediators, sounded the consuls of the United States at their respective courts, as to the dispositions of their government. Nothing definite could be drawn from either: they merely hinted what they hoped and believed, that nothing would be paid, either for peace or as tribute; and the mediators were not disposed to continue their good offices on such grounds. The Emperor of Morocco also undertook to load the ships lying at Gibraltar with wheat, and to procure for them, as his own property, American passports for Tripoli. These were however refused by the consul of the United States at Tangiers, and by the commander of their squadron; at which the Emperor was so much incensed, that he ordered the American consul to quit his dominions, and commenced hostilities against their commerce. Morat Rais, the Scotch renegade, was however conveyed on board a British ship of war to Malta, whence he easily passed over to Tripoli, much to the disappointment of Eaton, who considered him as the chief exciter of the difficulties, and as the only person in the Pasha's service at all acquainted with naval affairs. But very little advantage was derived from his skill; worthy Peter had indeed found it much easier to profit by the licenses of his new creed, than to submit to its restrictions, and some of his old propensities had probably been revived during his residence at Gibraltar; for after his return to Tripoli, he remained some time in a constant state of intoxication.

Yusuf still carried on his preparations for defence with great energy. Moors and Arabs were called in and enrolled, some principal persons from each village or tribe being kept as hostages in the castle. The Swedish and American prisoners were employed in repairing the fortifications, making gun carriages, &c.; and as no vessels could be built in Tripoli, some were purchased and prepared for use as cruisers.

But he had another object in view, of still greater importance; which was to get Hamet again in his power. In this the Bey of Tunis consented, it is said reluctantly, to aid him. Hamouda had no objection to see the Pasha of Tripoli in an embarrassed state, or indeed to have Hamet placed on the throne; but he was little inclined to favor the pretensions of the latter on the score of legitimacy, he himself being a usurper, and the heir to the throne of Tunis by regular descent, being a prisoner in his castle; he also apprehended that the success of Eaton's plan would encourage other christian powers to interfere in the concerns of Barbary. It was therefore proposed to Hamet to return to the government of Derne, which with his family, Yusuf offered to restore to him; and the proposition was accompanied by a hint that he would receive no farther supplies in case he remained in Tunis. The poor Prince thus driven to extremities was obliged to yield; a Russian vessel was in consequence engaged to convey him to Derne, and he was to be escorted by a guard of honor consisting of forty Tripoline soldiers, who had been sent to Tunis for the purpose.

Had these arrangements proceeded much farther, there can be little doubt as to what would have been the fate of Hamet; but information of them was conveyed to Eaton by the Sapatapa, whose services he had engaged before leaving Tunis. He was then at Leghorn, awaiting the determination of his government; no answer to his communication with regard to the restoration of Hamet had arrived, but he had just received a letter from the Secretary of State which authorized him to suppose that his plan would be favorably received. Therefore considering that the present circumstances were too important to permit delay, he hastily purchased and manned a vessel of fourteen guns, called the Gloria, and sailed in her for Tunis, where he arrived on the 18th of March, 1802. The Bey instantly demanded of him a passport for Hamet and his suite, who were on the point of departure. This he of course refused. Hamouda became outrageous, threatened to imprison him, and to declare war against the United States; but threats only suggested new resources to this energetic man, and his determination was soon taken. In order to secure himself however, he called a consultation of the principal Americans then in Tunis who having approved his measures, the Gloria was despatched with letters, to be delivered to the commander of the first American ship of war which could be met with, communicating the state of the affair, and requesting assistance to prevent the Prince from entering the Tripoline territory. The frigate Boston was luckily soon found; her commander, O'Neill, readily agreed to what was requested, and having commissioned the Gloria as an United States ship, to act against Tripoli, he sailed for the coast of Derne, in order to intercept the vessel carrying Hamet. The Gloria returned in a few days to Tunis. In the meantime Eaton had, by a promise of ten thousand dollars to the Sapatapa, to be given in case of the success of his plans, opened a communication with the Tripoline Prince, whom he was not permitted to see. Every means was used to operate on his hopes, his fears, and even his superstitious feelings. The prospects of his restoration by the aid of the United States, were contrasted with the danger, nay the certainty, of death, to which he exposed himself, by confiding in his cruel and perfidious brother; the prophecies of a Marabout, respecting his being replaced on the throne of Tripoli, by a people from the setting sun, were gravely and ingeniously repeated; and when all these representations had proved ineffectual, he was plainly assured that he would not be allowed to reach Derne, but that he would be attacked on his passage by the American squadron, and treated if taken, as a Tripoline enemy. The miserable exile had no other resource than to throw himself on the protection of the American consul. It was therefore arranged that he should sail ostensibly for Derne, furnished with a passport and also a private letter from Eaton, to be delivered to any American commander or other authority with whom he might fall in; and that the vessel should on the way put into Malta, under pretence of avoiding the Americans and Swedes. This was done, and Hamet landed safely at that island on the 11th of April.

The news of his arrival excited the strongest interest throughout Barbary. The Bey of Tunis pronounced that all was over with Yusuf, unless he made peace at once. The people of Tripoli were also much excited, as they expected an attack to be immediately made. Yusuf, though greatly alarmed, continued his preparations for defence; and it is said, assembled in the course of the summer, fifty thousand troops about the city; this was probably however, an exaggerated statement. His naval force ready for sea, amounted to one vessel of eighteen guns, one of sixteen, three of fourteen, and one of ten; with these, Morat Rais when a little sobered, proposed to sail for Gibraltar, and after releasing and manning the two vessels there lying, to put out on the Atlantic, where he expected to reap a rich harvest of prizes. In order to escape observation, he had provided his sailors with the dresses of christian nations; but this ruse, as well as the plan it was intended to promote, were soon communicated to the watchful Eaton, and by him to the officers of the squadron.

However Tripoli was so carelessly blockaded, that some of the vessels got to sea, one of which captured the brig Franklin, of Philadelphia, and carried her into Algiers, where an attempt was made to dispose of her and her crew. The American Consul at Algiers, remonstrated against this proceeding, and endeavored to procure the surrender of the brig and men, on the grounds that the Dey was bound, as guaranty of the peace between the United States and Tripoli, to cause her delivery. The Dey replied, that he had engaged to act only as mediator, but not to employ force in having the treaty respected; and that moreover the principal parties to it being then at war, and the United States actually holding Tripoli under blockade, the treaty as well as the guaranty were in fact at an end. However, after some delay, the Tripoline was ordered to quit the place, which he did, taking his prize with him, to the little port of Biserta, in the Tunisian territory, sixty miles from the capital; and the next day (July 8) the brig and her crew were advertised for sale at Tunis. What were the feelings of Eaton on this occasion may be conceived; his application to Commodore Murray who commanded the squadron nominally blockading Tripoli produced no effect; and to his mortification he saw the cruiser quit the place with the American captives in irons, (the brig being left at Biserta,) and heard of its safe entry into Tripoli actually in sight of the frigate Constellation. As a last resource, in order to alleviate the miseries of their captivity, he wrote a moderate and conciliatory letter to the Pasha, recommending him not to allow the American prisoners to be sold as slaves, but to have them treated with lenity, to refrain from farther hostilities, and even to receive Mr. Morris, the captain of the Franklin, as the agent of the United States until affairs could be arranged.