In 1825, he moved to Vicksburg and after a few years was elected for a single term to the state House of Representatives (1828–1829). He served briefly in 1832 as a circuit court judge before being elected a justice to the state supreme court later that year where he remained for 18 years until his resignation. Sharkey was appointed to the office of Secretary of War by U.S. President Millard Fillmore in 1851, but declined. From 1851 to 1854, he served as United States consul in Havana, Cuba.