JERUSALEM — Ehud Olmert, the brash former prime minister who was on the brink of a peace deal with the Palestinians when he was forced from office on corruption charges, on Tuesday became the most prominent former Israeli leader to be sentenced to prison, with a judge giving him six years for taking bribes while likening him to a traitor.

The stiff sentence stunned the political and legal establishment in a country where prosecutors’ anticorruption crusades have been condemned as overzealous and inefficient. In a lengthy indictment against Israel’s top political and financial echelon, Judge David Rozen of Tel Aviv District Court made clear that no leader would escape the law, declaring of public corruption, “The cancer must be uprooted.”

Mr. Olmert, 68, who is known equally for his expensive appetites and warm generosity even to political opponents, promised to appeal to the Supreme Court. Before the 9 a.m. sentencing, he issued a statement calling Tuesday “a sad day, on which a severe and unjust verdict is to be handed down to an innocent man.”

It was a striking denouement for a man who up until his March conviction had been openly planning a political comeback. Once a right-wing stalwart, Mr. Olmert helped create the centrist Kadima Party in 2005, and was prepared to yield nearly all of the West Bank to the Palestinians before he resigned in 2009. He had lately fashioned himself as a savior of Israel’s waning left, eviscerating Prime Minister Benjamin Netanyahu in speeches abroad and imagining that he alone could unite a fragmented field to unseat him.