Hanson's career in public service began in 1750, when he was appointed sheriff of Charles County. In 1757 he was elected to represent Charles County in the lower house of the Maryland General Assembly, where he served over the next twelve years, sitting on many important committees. Maryland was a proprietary colony, and Hanson aligned himself with the "popular" or "country" party, which opposed any expansion of the power of the proprietary governors at the expense of the popularly elected lower house. He was a leading opponent of the 1765 Stamp Act, chairing the committee that drafted the instructions for Maryland's delegates to the Stamp Act Congress. In protest of the Townshend Acts, in 1769 Hanson was one of the signers of a nonimportation resolution that boycotted British imports until the acts were repealed.