JOHANNESBURG - The first formal peace talks aimed at ending two years of war between the Ethiopian army and forces from the country's northern region of Tigray started in South Africa on Tuesday and will end on Sunday, the South African government said.

At stake is an opportunity to end a conflict that has killed thousands, displaced millions and left hundreds of thousands on the brink of famine in Africa's second most populous nation, destabilising the wider Horn of Africa region.

The talks, mediated by the African Union, begin as the government has been making significant gains on the battlefield, capturing several large towns in Tigray over the past week.

The government offensive, conducted jointly with allied troops from neighbouring Eritrea, has raised fears of further harm to civilians, leading African, U.S. and European leaders and even Pope Francis to call for a ceasefire and urgent talks.

South Africa "hopes the talks will proceed constructively and result in a successful outcome that leads to lasting peace for all the people of our dear sister country Ethiopia," said Vincent Magwenya, spokesman for South African President Cyril Ramaphosa.

The African Union mediation team is led by former Nigerian president Olusegun Obasanjo, supported by former Kenyan president Uhuru Kenyatta and former deputy president of South Africa Phumzile Mlambo-Ngcuka.

The conflict stems from grievances dating back to a period during which the Tigray People's Liberation Front (TPLF), a rebel movement-turned-political party, dominated Ethiopia's ruling coalition.

Since that coalition lost power at the national level in 2018, the TPLF, still powerful in its northern stronghold, fell out with the federal government led by Prime Minister Abiy Ahmed.

The government has accused the TPLF of seeking to restore its national dominance, which it denies, while the TPLF has accused the Abiy government of oppressing Tigrayans and over-centralising power, which it denies.

The Tigrayan delegation has said its focus at the talks in South Africa would be on an immediate cessation of hostilities, unfettered access to Tigray for humanitarian aid, and the withdrawal of Eritrean forces.

The government has said it views the talks as an opportunity to resolve the conflict and "consolidate the improvement of the situation on the ground", apparently a reference to its military advances in Tigray.

The war has compounded other serious problems in Ethiopia including a drought, the worst in four decades, that has caused a food crisis and damaged the economy.

(Reporting by Anait Miridzhanian and Bhargav Acharya; Writing by Estelle Shirbon; Editing by Bernadette Baum)