WASHINGTON — Secretary of State John Kerry announced on Wednesday that the United States and Afghanistan had finalized the wording of a bilateral security agreement that would allow for a lasting American troop presence through 2024 and set the stage for billions of dollars of international assistance to keep flowing to the government in Kabul.

The deal, which will now be presented for approval by an Afghan grand council of elders starting on Thursday, came after days of brinkmanship by Afghan officials and two direct calls from Mr. Kerry to President Hamid Karzai, including one on Wednesday before the announcement.

Just the day before, a senior aide to Mr. Karzai had said the Afghan leader would not approve an agreement unless President Obama sent a letter acknowledging American military mistakes during the 12-year war. But on Wednesday, Mr. Kerry emphatically insisted that a deal was reached with no American apology forthcoming.

“President Karzai didn’t ask for an apology. There was no discussion of an apology,” Mr. Kerry said. “I mean, it’s just not even on the table.”