COLOGNE, Germany — Annegret Kramp-Karrenbauer, at times considered a top candidate to succeed Angela Merkel as German chancellor, is the country’s new defense minister following the election of Ursula von der Leyen as European Commission president.

News of the surprise development broke late Tuesday night, as some in Germany were expecting Health Minister Jens Spahn to get the job.

Kramp-Karrenbauer recently said she would rather remain at the helm of the Christian Democratic Union than take a Cabinet position.

Merkel has said Monday that she wanted to fill the defense minister job as quickly as possible after von der Leyen announced her resignation, effective Wednesday, earlier that day. The now-former defense minister was narrowly voted into the top European Union job by the European Parliament on Tuesday evening, garnering 383 votes out of 747, or nine more than needed for confirmation.

Kramp-Karrenbauer is a relative newcomer on the military and geopolitical stage. She has generally championed budget hikes for the Bundeswehr and earlier this year attracted some attention with comments that she backs the idea of a European aircraft carrier. (No plans for such a ship exist.)

She inherits from von der Leyen a ministry in the midst of multibillion-euro investment decisions on major defense programs. Those include a heavy transport helicopter dubbed STH, the TLVS missile defense system and the MKS-180 multirole combat ship for the Navy.

Kramp-Karrenbauer will have to confront the Bundeswehr’s ongoing readiness crisis that has repeatedly seen non-deployed units deal with significant equipment shortfalls. Von der Leyen has argued the problems stem from decades of under-investment in Germany’s armed forces during a time when post-Soviet Russia was expected to deepen its ties with the West.

Next up for the new defense minister is a potentially grueling debate on Germany’s defense budget, set to continue after the summer recess. The Merkel government recently proposed a defense-spending trajectory that risks falling even below Berlin’s self-declared target of 1.5 percent of gross domestic product by 2024, whereas the NATO-agreed spending goal is 2 percent.