Edén led the Liberals to heavy gains in the election of 1917. Between them, the Liberals and Social Democrats held a clear majority in the Second Chamber. Nonetheless, King Gustaf V invited the liberal-conservative Johan Widén to form a government. However, the conservatives were unable to line up enough support to form a government. It was now clear that a king could no longer appoint a government dependent solely on him, nor could he keep it in office against the will of the Riksdag. With no choice but to appoint a Liberal as prime minister, Gustaf invited Edén to form a government. He formed a coalition with the Social Democrats, led by Hjalmar Branting who became minister for finance.