Stanford was politically active and became a leading member of the Republican Party. In 1856, he met with other Whig politicians in Sacramento on April 30 to organize the California Republican Party at its first state convention. He was chosen as a delegate to the Republican Party convention that selected US presidential electors in both 1856 and 1860. Stanford was defeated in his 1857 bid for California state treasurer, and his 1859 bid for the office of governor of California. In 1860, he was named a delegate to the Republican National Convention in Chicago but did not attend. He was elected governor in a second campaign in 1861.