NAIROBI (Reuters) - Kenyan doctors ended a three-month strike in public hospitals on Tuesday after reaching agreement on pay and working conditions, ending a standoff that threatened to embarrass the government before August’s elections.

The agreement grants doctors increased allowances, outlines a promotion plan and protects doctors who went on strike from retribution. County governments will recognize the union and conclude local agreements within 60 days.

“This bring to an end one of the most painful of experiences in labor relations in the country,” said Peter Munya, governor of Meru county and chairman of the Council of Governors.

“We wish that this country shall never experience this again,” said Ouma Oluga, the secretary general of the Kenya Medical Practitioners Pharmacists and Dentists’ Union, which has around 5,000 members in state hospitals.

The doctors went on strike on Dec. 5, demanding authorities implement a 2013 agreement to give them a 150 to 180 percent pay rise. Last week, they rejected an offer of a pay rise of 50 percent.

Private doctors were flooded with patients during the strike, but many Kenyans were unable to afford the fees and could not get treatment.

The strike saw white-coated doctors hold street protests outside government offices when union leaders were briefly jailed.

The protests upset the government of President Uhuru Kenyatta, who is seeking reelection when Kenya holds parliamentary and presidential elections in August.