The mayor of Hungary’s capital on Friday announced he would withdraw from a primary contest which will choose a joint opposition nominee to challenge right-wing Prime Minister Viktor Orban, ending his candidacy in a race in which he was once considered the frontrunner.