UK elections
Labour Party leader Jeremy Corbyn (left) and Prime Minister and Conservative Party leader David Cameron are shown in this 2015 file photo, with former Prime Ministers Tony Blair and John Major behind them. Local, mayoral and assembly elections take place in the U.K. on Thursday, offering both leaders the chance to firm up their positions amid the Brexit debate and other controversies. Getty Images

LONDON — A raft of political prizes will be up for grabs when Britain elects local councils, regional assemblies and the London mayor Thursday, but, for the leaders of the country's two largest parties, a successful showing offers the chance to sidestep difficult questions about their leadership.

The biggest office up for grabs is that of mayor of London, and polling shows that Labour MP Sadiq Khan is likely to best his rival, an MP from the governing Conservative party, Zac Goldsmith. A win for Khan would hand an office with a very high profile to the opposition party, and represent a big win for its beleaguered leader, Jeremy Corbyn, who is facing his first electoral test as party leader.

Since taking over the leadership of Labour in September last year, Corbyn has faced a number of crises, ranging from the resignation of high-profile MPs from his shadow Cabinet to a damaging debate about anti-Semitism in the party, which has prompted a raft of media speculation about a possible challenge to his leadership.

The latest outbreak began when a political blog uncovered a Facebook post shared by Labour MP Naz Shah, before she took office, in which she suggested the Israel's population be “transported” to the United States. The comments caused widespread indignation, and the scandal escalated when former Labour London mayor and Corbyn ally Ken Livingstone defended Shah, and made comments suggesting that Hitler had been a Zionist.

Corbyn suspended both Shah and Livingstone from the Labour Party over their comments, but was criticized for not acting swiftly enough, and accused by critics of failing to tackle a culture of anti-Semitism within his party.

Corbyn's strongly left-wing stance on a number of issues, such as the maintenance of the U.K.'s nuclear deterrent, has also raised concerns within the party and beyond about his ability to lead Labour to a general election victory. A solid Labour performance in the local council elections, viewed as barometer of national support for the party, would go some way to addressing concerns about his leadership, or at least prevent another damaging round of media speculation about internal challenges.

Corbyn has pledged that the party will lose no seats in the local elections, despite some experts' predictions that Labour could be on course for its worst results in 35 years.

For Prime Minister David Cameron, a defeat for Goldsmith in London's mayoral race could yet have a silver lining: Although his party would lose a high-profile office with real power over the capital, a rejection of Goldsmith, who supports a British exit from the European Union, could also be seen as an endorsement of Cameron's campaign to remain in the bloc.

Cameron, who on Wednesday faces a grilling in the House of Commons on the Brexit campaign, has faced schisms within his party over the issue. Several high-profile members of his Cabinet, along with outgoing London Mayor Boris Johnson, support the campaign to leave, and Work and Pensions Secretary Iain Duncan Smith resigned his Cabinet post over the issue, in a major blow to Cameron's credibility.

A strong showing in the local and assembly elections would give Cameron a boost by staving off media criticism. Cameron has said that he will not run for another term in Downing Street, so securing the vote to stay in the EU is a means of cementing his legacy.