BRUSSELS — U.S. and Afghanistan officials said Tuesday that they are confident tribal elders and the Afghan population will agree to keep U.S. and coalition troops in the country after 2014, even as a senior U.S. military official warned of high profile attacks and assassinations leading up to Afghanistan’s presidential elections next year.

The comments come amid persistent uncertainty about the security agreement, including provisions allowing the U.S. military to continue to conduct counterterrorism operations and ensuring that U.S. military courts, not the Afghans, would maintain legal jurisdiction over American forces that stay in the country.

A senior U.S. official said that Afghan Defense Minister Bismillah Mohammadi told U.S. Defense Secretary Chuck Hagel that he has strong confidence that the agreement would be endorsed soon and that the vast majority of Afghans support it. The two spoke during a NATO meeting where leaders were getting updates on the war and progress of the Afghan forces.

In a separate discussion, a senior U.S. military official said he is pretty confident that the agreement will be signed, adding that he has spoken to Afghans at every level and none have said the bilateral security agreement was a bad idea.

The military official also said that Afghans recognize that keeping U.S. and coalition troops in the country after 2014 to train and assist the Afghan forces is key to getting the more than $4 billion in financial support that allied nations have pledged to provide.

The officials spoke on condition of anonymity because they were not authorized to discuss the issues publicly due to NATO rules.

U.S. Secretary of State John Kerry and President Hamid Karzai reached an agreement about a week ago on the key elements of a deal that would allow American troops to stay after 2014, when combat troops are scheduled to leave. One key unresolved issue — which is a deal breaker for the U.S. — is whether U.S. military courts maintain legal jurisdiction over the troops.

The U.S. official said Hagel made it clear to Mohammadi that jurisdiction is a must for the security agreement.

Karzai said that issue must be discussed by the consultative assembly of tribal elders, or Loya Jirga, before he makes a decision.

The national meeting is expected to start between Nov. 19 and 21 and could last as long as a week, with as many as 3,000 people attending. The Loya Jirga is not binding but Karzai is likely to follow it. The agreement would then have to be ratified by the Afghan Parliament.

There have been repeated worries that the complex agreement could fall apart in much the same way that U.S. negotiations with Iraqi leaders collapsed over the issue of troop immunity. The U.S. then pulled all of its troops out of Iraq.

Officials Tuesday sought to present a more optimistic view of the Afghan situation, while still acknowledging that there are still challenges ahead.

In particular, the military official warned that based on intelligence reports and discussions with Afghans, the U.S. is expecting the Taliban to try to disrupt April’s elections with high-profile attacks and targeted killings aimed at candidates and high-level officials.

The military official said that although the peak fighting season is ending, the winter is likely to focus more on kinetic attacks than in the past. He said he expects a concerted effort by the enemy to try and prevent successful elections and the Afghan security forces are preparing for that fighting campaign now.

The official added that in the coming months the U.S. and coalition forces will focus less on building the proficiency of individual Afghan units, and more on improving broader capabilities such as logistics, intelligence gathering, budgeting and command and control.

U.S. officials have said that the U.S. and NATO would like to keep between 8,000-12,000 troops in Afghanistan to train and assist the Afghan force and conduct counterterrorism operations against al-Qaida. Both Hagel and the U.S. military official said they are still comfortable with that range of numbers.

They noted, however, that the number of troops is just one of the key components for success. The state of the Taliban, cooperation from Pakistan in battling the insurgency and the Afghan political process are also important.

Hagel told reporters traveling with him that the sooner an agreement is reached, the better. But he said there is still sufficient time.

“I don’t think there’s any deadline that we have to have it by Thanksgiving,” said Hagel, as he was traveling to the NATO meeting. “If we stay on track — that gives us plenty of time.”

If the security agreement is not signed, all troops would leave at the end of next year. President Obama said in an interview with The Associated Press he would be comfortable with a full pullout of U.S. troops.