He served as a Massachusetts state senator and a U.S. senator, and then, during James Monroe's presidency, as secretary of state, where he was largely responsible for formulating the principles behind the Monroe Doctrine.
He was a senator for the state of Massachusetts as well as the US, then was secretary of state under James Monroe where he formulated principles behind the Monroe Doctrine. 
He was never in government. 