Pakistan military officials say fighting in a remote tribal area near the country 's border with Afghanistan has killed 23 Islamic militants and seven Pakistani troops .