Afghanistan's two feuding presidential candidates have agreed to end their dispute and plan to set an inauguration date before the end of August.

U.S. Secretary of State John Kerry arrived in the country during an unannounced visit Thursday, days after an American general was killed by an Afghan soldier.  Major General Harold Greene was the most senior casualty suffered by the U.S. so far in the war. Kerry had been negotiating talks in Afghanistan for months, attempting to repair the delicate relations in time to prevent renewed political chaos in the country. 

This time, he urged the two candidates move on—and they agreed.

"This is really an Afghan solution to an Afghan problem," Kerry said at a news conference. "Both parties have agreed to stay at it and both parties have agreed to live by the outcome."

The candidates, former Foreign Minister Abdullah Abdullah and former Finance Minister Ashraf Ghani Ahmadzai, had been disputing the results of a runoff election in June, with each man declaring himself the successor to Afghan President Hamid Karzai. Ahmadzai referred to Abdullah as a "brother and colleague" Friday, noting the importance of moving forward to end the "vicious circle" of unrest.

Abdullah reciprocated the sentiment, calling the end of the feud "another step forward in the interests of strengthening national unity in the country, strengthening rule of law in the country and bringing hope to the people for the future of Afghanistan."

It's been several tumultuous months for the two candidates and Kerry. After the June 14 runoff election resulted in accusations of fraud and irregularities—a common occurrence in the country—Kerry stepped in to broker an audit of the process. However, when Ramadan began late July, the tedious counting paused, and only resumed Monday this week. 

Kerry had attempted to push a resolution between the two at the time, telling them a resolution would mean "a way forward" that would "give Afghans confidence that they have a presidency and a government that is capable of unifying all Afghans and building a road to the future."

According to NBC News, Kerry will likely press for a new government to be formed by early September.