The neighboring country forced the troops back across the border, officials said, in what is believed to be the biggest setback for the Afghan security forces since a Taliban offensive in August.