Top generals told lawmakers under oath that they advised President Joe Biden early this year to keep several thousand troops in Afghanistan — directly contradicting the president’s comments in August that no one warned him not to withdraw troops from the country.