Gates just finished four days of meetings in Spain and Germany focused largely on the war in Afghanistan .