WASHINGTON—The Army general in line to take over as the new U.S. and allied commander in Afghanistan said that as the security there worsens the number of American forces should only be reduced if conditions allowed.

Lt. Gen. John Nicholson, nominated to be the new commander in Afghanistan, appeared before the Senate Armed Services Committee Thursday. Gen. Nicholson appeared poised to win confirmation and could be headed to Afghanistan by March.

Gen. Nicholson said he concurred with the committee’s chairman, Sen. John McCain (R., Ariz.), and others who raised alarm about recent attacks by Taliban insurgents.

“The view of many of us is that the security situation in Afghanistan has been deteriorating, rather than improving,” Mr. McCain said.

“Sir, I agree with your assessment,” Gen. Nicholson replied.