Afonso, then a count, is proclaimed first king of Portugal and declares independence from Castile