Attracted to politics from an early age, Stockmar became the Jurassian leader of the liberal movement that overthrew the Bernese patriciate and was one of the influential members of the 1831 Constitutional Assembly. He served as prefect of Porrentruy from 1831 to 1835 and was a deputy in the Bernese Grand Council (1831–1835, 1839, 1846, 1850–1854, 1858–1862). In 1832, he founded the liberal newspaper L'Helvétie.[1]
In 1835, Stockmar was appointed to the Council of State. However, in 1839 he was dismissed by the Grand Council on charges of treason. He was suspected of leading the separatist movement, which had been provoked notably by Bern's intention to abolish French legislation in the Jura. Facing the threat of arrest in 1840, he went into exile in France.[1]
While in exile, Stockmar conceived a project for a Swiss colony in Algeria, which was rejected by the French government in 1841. After living in Paris from 1841 to 1842, he managed the steel factory in Valentigney, Doubs, from 1843 to 1845, then retired to his property in Rosières, near Blamont in the Doubs.[1]
His return to Switzerland in 1846 occurred in the context of the radical revolution. Stockmar was elected to the Bernese Constitutional Assembly and once again to the government (1846–1850). After the victory of the conservatives in 1850, he resumed management of the Bellefontaine forges in 1852, before returning to the Council of State (1862–1864), where he headed the Department of Public Works.[1]
During the Sonderbund War, Stockmar served as federal commissioner in Fribourg. He was a member of the Swiss National Council from 1848 to 1851 and again from 1854 to 1864. He was a co-founder of the Société jurassienne d'émulation in 1847 and one of the principal promoters of railway development in the Jura.[1]