Hay served for almost seven years as Secretary of State, under President McKinley, and after McKinley's assassination, under Theodore Roosevelt. Hay was responsible for negotiating the Open Door Policy, which kept China open to trade with all countries on an equal basis, with international powers. By negotiating the Hay–Pauncefote Treaty with the United Kingdom, the (ultimately unratified) Hay–Herrán Treaty with Colombia, and finally the Hay–Bunau-Varilla Treaty with the newly independent Republic of Panama, Hay also cleared the way for the building of the Panama Canal.