Jefferson appointed the financially struggling Lear to the potentially lucrative assignment of American
commercial agent in
Saint-Domingue at the start of his term of president. During this job, Lear appointed Rollins to oversee Walnut Tree Farm. Unfortunately, Lear arrived right before
Napoleon Bonaparte was about to clamp down on the slave rebellion there. In a January 17, 1802, in a long letter of gratitude to Jefferson, Lear predicted the long anticipated French response was still six months out. One week later, a French armada arrived at
Cap-Français and captured the main port there from
Toussaint L'Ouverture. Lear attempted to help the Americans during the ensuing French embargo. However, with the
Louisiana Purchase looming large for Jefferson, Lear was asked not to irritate the French commanders, and after a suggestion from
James Madison, retreated back to Virginia. A year after returning to the U.S., in 1803, Jefferson appointed Lear, now 41, to be
Consul General to the
North African coast with the privilege of simultaneously conducting private business. Before preparing to depart on the
USS Philadelphia to
Algeria, Lear was married for the third time (to Frances Dandridge Henley). In a last-minute change, the Lears were reassigned to the
USS Constitution, and the
Philadelphia ended up being captured in the Mediterranean. Lear became the primary negotiator for the crew's release in 1805 with the
Treaty of Tripoli that ended the
First Barbary War in which he was alleged to have mishandled the resolution. The Lears stayed on in Algiers until 1812 when Lear fell out of favor with the
Dey. Upon their return, the U.S. was in the throes of the
War of 1812. Consequently, they had to follow a circuitous route back to Portsmouth from their entry in Virginia. Under James Madison, he was then appointed as a secretary to the
War Department and moved to a location a few blocks from the
White House. While serving in this post, the
British attacked and
burned the city. In 1814, Lear was elected a member of the
American Antiquarian Society. ==Death==