OPERATING BASE FENTY, Afghanistan — The Islamic State is establishing “little nests” in Afghanistan, adding to the complex array of threats confronting Afghan forces and their international partners as they try to reverse a serious decline in security, Defense Secretary Ashton B. Carter said Friday.

Mr. Carter was visiting this base in eastern Afghanistan, where he conferred with Gen. John F. Campbell, the American commander of the international coalition that is supporting Afghan forces, and Mohammad Masoom Stanekzai, the acting Afghan defense minister.

General Campbell painted a sobering picture of the fighting ahead, though he said the American military was trying to help the Afghan forces adapt so that they could limit their casualties.

“We just went through a very tough fighting season,” General Campbell told reporters traveling with Mr. Carter. “We don’t even talk in terms of fighting seasons anymore because it is kind of continuous fighting.”

Operating Base Fenty, which has about 600 American troops, is one of the so-called enduring bases that the United States intends to keep open after 2016, as outlined in President Obama’s amended plan for troop withdrawals from Afghanistan. The base, near Jalalabad in Nangarhar Province, was named after Lt. Col. Joseph J. Fenty Jr., who was killed in a helicopter crash in 2006 while overseeing the extraction of a scout team in the mountains nearby.

A senior Defense Department official described the area as a “gateway” for militant groups seeking to make their way toward Kabul, the capital, and other critical areas. “The kind of defensive action that occurs as far out as Fenty is really important for other parts of the country,” said the official, who could not be identified under the Pentagon’s protocol for briefing reporters.

Apache attack helicopters patrolled overhead as officials listed the militant groups that the Afghans and the international coalition faced. The Taliban have been a formidable adversary, overrunning checkpoints and briefly occupying the northern city of Kunduz as they seek to put themselves in a position of strength in the event of peace talks.

For the Taliban, “this year was all about showing control,” General Campbell said.

The Haqqani network, based in neighboring Pakistan, presents the greatest threat to Kabul, while an affiliate of Al Qaeda has established a training camp in the Kandahar area. As the fighting has intensified, government forces and the Taliban have suffered more casualties.

“In the second half of 2015, the overall security situation in Afghanistan deteriorated, with an increase in effective insurgent attacks and higher A.N.D.S.F. and Taliban casualties,” the Pentagon said in a report issued this week, using the initials for the Afghan National Defense and Security Forces.

“From the beginning of January through mid-November, there was a 27 percent increase in Afghan security force casualties compared with a comparable period last year,” it added.

The Islamic State, also known as ISIS or ISIL, is a new wild card. Western officials initially believed that a breakaway faction of the Taliban in Afghanistan was merely using the Islamic State name, primarily to distinguish itself from other militants. But in recent months, the core group of the Islamic State, which has declared a caliphate in much of Syria and Iraq, delivered several hundred thousand dollars to the Afghan fighters, which has helped them gain ground and recruits.

General Campbell said there were 1,000 to 3,000 fighters in Afghanistan from the Islamic State. Over the past five months, they have begun to coalesce in Nangarhar Province, sometimes clashing with their Taliban rivals. The fighters’ goal, he said, is to move into the city of Jalalabad, expand to neighboring Kunar Province and eventually establish control of a region they call Khorasan, an old name for an area that includes Afghanistan and Pakistan.

“They haven’t kept it any kind of secret,” General Campbell said. The group does not yet have the ability to plan and carry out attacks in Europe or the United States, he added, but “left unchecked, it will.”

As the Islamic State’s strength has grown here, rumors have spread in Afghanistan that the government is secretly supporting the group. At a joint news conference with Mr. Carter, Mr. Stanekzai dismissed the idea as antigovernment propaganda and noted that he had consulted on Friday with local elders to discuss ways to prevent the group from gaining a larger foothold in Nangarhar Province.

Instead of the Afghan government, he said, blame for the Islamic State’s growth rests with the terrorist network that is supporting the militants from “just across the border”: ungoverned areas in Pakistan.

General Campbell said he was taking a number of steps to help the Afghan forces, including encouraging them to shift personnel away from checkpoints, where they are more vulnerable and less effective, and increasing efforts to train their military leaders. To help Afghanistan build an air force, the United States is also funding the acquisition of A-29 turboprop aircraft, 20 of which are to be provided by 2018. The first eight aircraft are to be delivered in early 2016.

The trip to Afghanistan was Mr. Carter’s first since Mr. Obama scrapped his initial troop withdrawal plan as militants gained strength and the new Afghan government looked to the United States for more support. Under the new plan, the Obama administration will keep 9,800 troops in the country through almost all of 2016, at which point the number will be reduced to 5,500.

Mr. Stanekzai said Afghanistan wanted a long-term security arrangement with the United States and suggested that any troop withdrawal plans should be adaptable enough to deal with changing threats, not based on a rigid timeline.

“We need a long-term commitment,” he said. “We need flexibility.”

Eric Schmitt contributed reporting from Washington.

Get news and analysis from Asia and around the world delivered to your inbox every day with the Today’s Headlines: Asian Morning newsletter. Sign up here.

A version of this article appears in print on , on Page A9 of the New York edition with the headline: Islamic State Building ‘Nests’ in Afghanistan, U.S. Says. Order Reprints | Today’s Paper | Subscribe