LONDON (CNN) -

William Hague announced his resignation as Britain's foreign secretary, in what was perhaps the biggest surprise of a major government reshuffle by Prime Minister David Cameron.

Hague, who has served in the role for four years, will be the leader of the House of Commons until next year's general election.

Hague said he was proud of the work he had done in the Foreign Office but that he'd been involved in politics for a long time. He was first elected to Parliament in 1989 and, among other roles, led the Conservative Party in opposition from 1997 to 2001.

"Renewal in politics is good, and holding office is not an end in itself. After 26 years as an MP, time will be right for me to move on," he tweeted Monday.

Cameron praised the contribution made by Hague.

"I'd like to pay an enormous tribute to (Hague), who is standing down as an MP at the next election," Cameron tweeted Monday night. "Until then, I'm delighted he'll remain my de facto political deputy, play a key campaigning role and be Leader of the House of Commons."

Cameron confirmed Tuesday that Philip Hammond would step into Hague's shoes at the Foreign Office. Hammond, who has been serving as UK defense secretary, is seen as a critic of the European Union.

Cameron has promised a referendum on UK membership of the EU by the end of 2017 if he is still Prime Minister after the 2015 election. His Conservative Party currently governs in coalition with the Liberal Democrats.

Cameron has called for EU reform but was recently thwarted in his efforts to block the appointment of Jean-Claude Juncker as the next president of the European Commission, taking office later this year. That appointment is expected to be confirmed in a European Parliament vote later Tuesday.

Another casualty of the Cabinet reshuffle was veteran MP and former chancellor of the exchequer Ken Clarke, who is a strong pro-European voice.

"Ken Clarke has been a political Titan for more than a generation. His wise and trenchant views will be missed around the Cabinet table," Cameron said via Twitter.

While foreign secretary, Hague took a prominent stand on the issue of ending sexual violence in conflict, teaming up with Hollywood star and U.N. special envoy Angelina Jolie to call for global action. The pair co-chaired a summit in London last month which brought together representatives from nearly 130 countries.

Hague said on Twitter that he would continue to lead the UK campaign to end sexual violence in conflict as Cameron's special representative.

He added, "I'm proud we now have a restored @foreignoffice, revived alliances, a new course in Europe, and stronger UK leadership on #humanrights."

Hague has previously published two books on British political history.