José Eduardo dos Santos, the former president of Angola who was one of Africa’s longest-serving heads of state, stepped down on Saturday from the leadership of the country’s governing party, acknowledging that he had made mistakes in almost four decades in power but saying that he held his “head high.”

The governing party, the Popular Movement for the Liberation of Angola, known as M.P.L.A., has led the oil-rich country since its independence from Portugal in 1975. After the party won the most parliamentary seats in elections a year ago, it designated João Lourenço, the defense minister and a former governor, to replace Mr. dos Santos, who had announced that he would step down.

Since taking office in September 2017, Mr. Lourenço has pledged to dismantle the corruption that flourished under his predecessor.

Mr. dos Santos assumed office in 1979, becoming Angola’s second president. In remarks on Saturday, he said that he had not expected to remain in power so long, and he acknowledged that everyone makes mistakes.