MOGADISHU, Somalia — Politicians have been peeling off wads of hundred dollar bills to buy votes. Others have shown up for parliamentary races standing next to a political nobody who was bribed or coerced into running against them, to make the race look fair. In one case, the mysterious candidate was the politician’s maid.

This week, Somalia, which has languished without a functioning central government for more than 25 years and has been propped up by billions of dollars of American aid, is holding an innovative, closely watched presidential election that United Nations officials have billed as a “milestone.”

But several analysts, investigators and some Western diplomats say the election has turned out to be a milestone of corruption, one of the most fraudulent political events in Somalia’s history — and that’s saying something, given that the country is already ranked by Transparency International, a global anticorruption organization, as the most corrupt on earth.

Somali investigators estimate that at least $20 million has feverishly changed hands during parliamentary elections that will culminate in the selection of the president on Wednesday.

Outside forces like Turkey, Sudan, the United Arab Emirates and Qatar are widely believed to have been buying off presidential candidates to land juicy business deals, spread a harsh version of Islam or spy on American forces.

The entire process has been so bad, several analysts said, that the Shabab militant group, one of the deadliest Islamist organizations in the world, isn’t even trying to derail the vote because the corruption free-for-all almost makes the militants look upstanding by comparison.