The Biden administration is studying whether and how the United States could support an anti-Russian insurgency inside Ukraine if President Vladimir Putin invades that country and seizes substantial territory.

The planning, described by a knowledgeable official, includes ways to provide weapons and other support to the Ukrainian military to resist invading Russian forces — and similar logistical support to insurgent groups if Russia topples the Ukrainian government and a guerrilla war begins.

The weapons the United States might provide include shoulder-fired antiaircraft missiles. The CIA’s delivery of such weapons, known at the time as “Stingers,” had a devastating effect on Soviet forces during their 10-year war in Afghanistan, from 1979 to 1989.

The administration task force, which includes the CIA and other key agencies, has been studying how insurgencies were organized against the Soviets in Afghanistan and Russian-backed forces in Syria — and also against the United States in Iraq and Afghanistan. It’s an ironic example of turning the tables, weighing whether and how to inflict harm similar to what U.S. forces have suffered in recent years.

The task force includes a legal team that is studying how any assistance to a Ukrainian insurgency could be provided without violating U.S. or international laws.

The administration’s basic goal is to impose costs if Putin invades Ukraine, without directly involving U.S. troops — a step that President Biden has ruled out. White House officials believe that threatening direct military intervention would be a mistake because Biden isn’t willing to risk all-out war over Ukraine. Gray-zone tactics are better.

The insurgency planning supplements other Biden administration efforts to raise the stakes for Putin. U.S. officials have warned that America and its European allies would impose severe economic sanctions that could cripple the Russian economy. And NATO announced plans last week to move troops forward, toward Russia, if Putin ignores warnings. That would leave Russia more vulnerable to Western military pressure following an invasion, the opposite of what Putin hopes to achieve.

In framing these contingency plans, the administration is trying to strike a balance. The White House wants to deter an invasion, without offering the Russian president a pretext for escalating the crisis. Too much saber rattling could bring about precisely the scenario that Washington hopes to avoid.

While rejecting Putin’s maximalist proposals for spheres of influence in Eastern Europe, the administration wants to keep negotiations open. Speaking of Putin’s demands, the senior official said: “There are some things in those documents that the Russians know will be unacceptable. … But there are other things that we are prepared with work with and that merit some discussion.”

In military terms, the Ukrainian army isn’t a match for Russian troops, but it’s 50 percent larger than the force Ukraine had in 2014, when Russia seized Crimea. In addition, sources said that about 500,000 Ukrainians have had some militia training since 2014, and that at least a million weapons are in private hands. These would be among the building blocks for an insurgency. U.S. planners have discussed weapons caches and other logistical tools that could support a potent “stay-behind network” if Russia invades.

The United States has supplied Javelin antitank weapons to the Ukrainian military, initially under tight controls. Similar controls would probably apply to any antiaircraft weapons, to make sure they didn’t fall into terrorist hands.

A small number of U.S. Special Operations forces have been advising the Ukrainians, as part of a U.S. military team of about 150 people there now. The CIA also has a paramilitary branch with experience in organizing insurgencies in Afghanistan and Syria.

When U.S. troops were poised on the border of Iraq in 2003, U.S. officials didn’t consider the grinding, enervating war of counterinsurgency that lay ahead. The Biden administration believes that Putin may be on the verge of making a similar mistake in Ukraine. They hope he doesn’t make the wrong choice, but if he does invade, they want to make it hurt.