KABUL, Afghanistan — The rivals to become Afghanistan’s next leader pledged Friday to work together to speed an audit of the disputed election and accept its results after weeks of delays and partisan squabbling.

Former Foreign Minister Abdullah Abdullah and former Finance Minister Ashraf Ghani issued a joint statement, brokered under American and United Nations auspices. The candidates agreed to a joint commission to “finalize a timeline for the electoral process,” a reference to the slow-moving audit of more than 8 million ballots, according to an English version of the statement. The commission will set a date for the inauguration, the statement said.

The goal is to have a new leader in place by the end of August, an ambitious schedule that few international observers had thought could be met. The United States has been warning that failure to have a new president in place before the summit of NATO leaders in early September would undermine international faith in the fragile government and could dry up vital financial aid.

Although the agreement was short on details, the lengthy public comments by both Abdullah and Ghani on Friday were unequivocal in their commitment to completing the audit quickly and accepting its results, forming a joint government with the winner as president and the loser as chief executive, and shifting from wrangling over the past to cooperating for the future.

“We are working for a shared goal, and we are committed to working together for the sake and the interests of Afghanistan,” Abdullah said at a joint news conference with Ghani and Secretary of State John Kerry.