Later, he was elected by the South Carolina state legislature to three separate terms in the United States Senate, but changed his party allegiance: beginning as a Federalist, he switched to the Jeffersonian party in 1795.