WASHINGTON—Defense Secretary Leon Panetta is hailing what he calls "the last chapter" of a long and costly struggle to ensure that Afghanistan can govern itself and avoid reverting to a haven for terrorists.

In remarks at the start of a meeting in his Pentagon office with visiting Afghan President Hamid Karzai, Panetta reflected on what he called a decade of great sacrifice by Afghans as well as their coalition partners.

Panetta was conferring with Karzai a day ahead of the Afghan leader's meeting at the White House with President Barack Obama.

Karzai followed Panetta's remarks by saying he could assure Americans that Afghanistan will soon be able to provide for its own security. And he said it will never again be threatened by what he called "terrorists from across our borders."