NAIROBI, Kenya — For almost three decades, President Omar Hassan al-Bashir ruled Sudan with a heavy fist, jailing opponents and former allies, overseeing the bloody suppression of the Darfur region and squashing protests that dared to challenge his regime.

But on Saturday, Mr. al-Bashir, 75, was convicted of money laundering and corruption and sentenced to two years in detention in a much-anticipated trial that was the first attempt by his own citizens to call him to account.

Wearing the traditional Sudanese white jalabiya garment and turban, Mr. al-Bashir stepped into a packed court in central Khartoum and was corralled in a meshed metal defendant’s cage. Once a powerful strongman who ruled one of Africa’s biggest nations, he stood with his head bowed as the judge read the charges against him while several police officers stood around.

The judge, citing his age, ordered him to serve his time in a correctional center for older prisoners.