KABUL - US Defense Secretary Ashton Carter arrived in Afghanistan Friday for meetings with military commanders, as the security situation deteriorates with a surge in Taliban attacks and the creeping emergence of the Islamic State group.

The unannounced visit comes just days after a Pentagon report presented a grim portrait of the war which has inflicted a growing number of casualties on hard-pressed Afghan forces.

During an event with soldiers at a US base near Jalalabad city in the eastern province of Nangarhar, Secretary Carter warned of the Taliban's continued threat to security in the country, while lauding the troops for training Afghan forces to battle the insurgents.

"The Afghan security forces are getting there," said Carter, according to a statement released by the Department of Defense. "They're fighting, number one, and number two, they're fighting more and more effectively as they operate more and more on their own."

The volatile province of Nangarhar also faces an emerging threat from loyalists of the Islamic State group (IS), which is making gradual inroads in Afghanistan, challenging the Taliban on their own turf. During his speech, Carter vowed to root out IS in both the Middle East and elsewhere.

"We're going to kill it in its home tumour of Iraq and Syria," said Carter. "But then we have to recognise that there are little nests of it spring up all over -- all over the world."

This month marks a year since the US- and NATO-led mission in Afghanistan transitioned into an Afghan-led operation, with allied nations assisting in training local forces. President Barack Obama in October announced that thousands of US troops will remain in Afghanistan past 2016, backpedalling on previous plans to shrink the force and acknowledging that Afghan forces are not ready to stand alone.

The Taliban briefly captured the strategic northern city of Kunduz in September in their most spectacular victory in 14 years, dealing a stinging blow to Afghan forces as they battle the insurgents on multiple fronts. The Taliban have since then threatened several other provincial centres -- from Lashkar Gah in the south to Maimana in the northwest -- raising concerns that Afghanistan was on the brink of a security collapse.

Fuelling those fears is a new Pentagon report released this week detailing a surge in Taliban attacks in the second half of 2015. Obama has said the United States will maintain its current force of 9,800 in the country through 2016.

After that the United States will leave a force of 5,500 troops in place to train Afghan forces and conduct counter-terrorism missions. Obama's decision recognised Afghan forces "will require more time and assistance to develop into a capable, credible and independent force", the Pentagon report stated.

The Taliban have stepped up attacks on government and foreign targets despite President Ashraf Ghani's diplomatic outreach to Pakistan aimed at reviving peace talks with the resurgent group. Pakistan, which wields considerable influence over the Taliban, hosted a milestone first round of peace negotiations in July.

But the talks stalled when the Taliban belatedly confirmed the death of longtime leader Mullah Omar, sparking a power struggle within the movement. Western officials have also warned that IS, attracting disaffected Taliban fighters, is an emerging threat in Afghanistan's eastern badlands bordering Pakistan.

Moreover, a group including figures from Afghanistan's anti-Soviet Mujahideen of the 1980s on Friday launched a new political bloc likely to increase the pressure on President Ashraf Ghani's struggling unity government.

The so-called Council for Protection and Stability in Afghanistan, many of whose members are close to former president Hamid Karzai, aims to push Ghani to meet commitments to hold parliamentary elections next year as well as a Loya Jirga, or grand assembly, on constitutional reform.

Though the group, which will not function as a formal parliamentary opposition party, says it wants to encourage reform and has no intention of trying to bring down the government.

But it could serve as a focus for discontent with Ghani's National Unity Government, which has struggled to implement all its reform pledges and has come under growing pressure as the Taliban insurgency has spread following the withdrawal of foreign troops last year.

Abdul Rab Rasoul Sayaf, a veteran of the fight against the Soviets in the 1980s who later joined the Northern Alliance movement fighting the Taliban, said the government had to honour its pledge to hold the Loya Jirga next year.

"The government must call the Loya Jirga on time and if it doesn't happen, the people will look for alternatives," he said at a gathering in Kabul to launch the new group.

The group also intends to pressure Ghani's government not to pursue peace talks involving Pakistan, which many in Afghanistan accuse of sponsoring the Taliban.

"Mr president, don't take your begging bowl to Islamabad and beg for peace because we have tried in the past and it didn't work," said former interior minister Umer Daudzai.

Under the power-sharing agreement reached after last year'a inconclusive elections, a Loya Jirga, bringing together representatives from all over Afghanistan, must be held next year to decide on constitutional changes that would allow the creation of the post of prime minister.

Parliamentary elections must also be held by the middle of next year but there has been widespread suspicion that Ghani and Chief Executive Abdullah Abdullah may not honour the commitment and instead seek to continue their power-sharing agreement. "If they think that the alternative to a Loya Jirga or election is consent between two individuals and extension of the contract, it will be wrong, illegal, a huge mistake and contrary to the will and expectation of the people," said Younus Qanooni, first vice president under former President Hamid Karzai.