James Mattis' confirmation hearing before the Senate Armed Services Committee is set for Thursday. | Getty Pentagon pick Mattis agrees to divest stock, recuse himself from matters involving General Dynamics

Retired Gen. James Mattis will divest his stock in General Dynamics and recuse himself from matters involving the defense contractor for one year if confirmed as defense secretary, according to an ethics agreement released Saturday by the Office of Government Ethics.

The two-page document, dated Jan. 5, says the retired Marine general will also resign from the GD board of directors, divest within 90 days all stock and vested options and forfeit any non vested stock and options.

Mattis joined the board of the Pentagon's fourth-largest contractor after retiring from the Marine Corps in 2013.

The legal agreement also states that , if confirmed , Mattis will step down from the board of the Hoover Institution at Stanford University. He's already resigned from the boards of Theranos, a bio tech firm ; the Center for a New American Security, a Washington think tank ; and several other organizations.

The Pentagon determined that Mattis did not have to divest his stock in Theranos, according to the ethics agreement, "because the duties of the position of secretary are unlikely to involve particular matters affecting the financial interests" of the lab testing company, which has been under scrutiny from federal regulators.

Mattis' confirmation hearing before the Senate Armed Services Committee is set for Thursday.

In order for him to become secretary of defense , both the Senate and House must pass an exemption to the law that requires that retired military officers wait seven years before taking on the role of civilian head of the military. It will be only the second time such a step has been required, after it was required for retired Gen. George Marshall in 1950.