President Barack Obama had spoken to Afghan president Hamid Karzai and British prime minister David Cameron about his decision to remove his top Afghanistan commander, General Stanley McChrystal, on Wednesday, a senior administration official said.