Stewart's later service included command of the American
Mediterranean squadron from 1816 to 1820 and of one in the
Pacific from 1820 to 1824. For South American patriots fighting for their independence, commodore Stewart's conduct in Peruvian waters was controversial because, claiming "neutral rights" for U.S. merchants, he escorted their ships through a patriot blockade to trade with Spanish royalists. His flagship, the USS Franklin, also transported a Spanish spy. (Stewart said he was unaware the Spaniard was on his ship, and he blamed his wife for secreting the man on board.) For these and other actions, the U.S. Navy subjected Stewart to a highly publicized court-martial upon return to the United States. Stewart's wife refused to testify in his defense, and they soon divorced. Stewart biographers Berube and Rodgaard concluded about his trial that, “the Navy desperately needed a not-guilty verdict as several of its senior-most captains faced courts-martial in the summer of 1825.” A board of twelve of Stewart's fellow officers found him not guilty. Stewart served as a
Naval Commissioner from 1830 to 1832. In 1836 Stewart saw service in the
West Indies and commanded a vessel that captured a Portuguese
slave ship as it came into
Havana. Before Stewart's boarding crew took control of the ship, the captain of the ship jumped overboard, swam ashore and escaped. On board the slave ship were 250 enslaved African children, with many other slaves onboard the vessel having already died from a lack of water during the voyage. Outraged at the conditions and health of the children, Stewart informed the British commissioner in Havana, a Mr. Kennedy, of the dire situation he had encountered. In the later years of his career, Stewart commanded the
Philadelphia Navy Yard from 1838 to 1841, in 1846, and again from 1853 to 1861. ==Senior officer==