After his coronation in the city of León in January 1066, Alfonso VI had to confront the expansionist desires (although Alfonso would prove himself as having the same or more so) of his brother Sancho II, who, as the eldest son, considered himself the sole legitimate heir of all the kingdoms of their father.
The conflicts began after the death of their mother Queen Sancha on 7 November 1067, leading to seven years of war between the three brothers.
The first skirmish was the Battle of Llantada, a trial by ordeal in which both brothers agreed that the one who was victorious would obtain the kingdom of the defeated brother.
Although Sancho II was the winner, Alfonso VI did not comply with the agreement; even so, relations between them remained cordial as evidenced by the fact that Alfonso was present at the wedding of Sancho II to an English noblewoman named Alberta on 26 May 1069.
This was the same event where both decided to join forces to divide between themselves the Kingdom of Galicia that had been assigned to their younger brother García II.

With the complicity of Alfonso VI, Sancho II invaded Galicia in 1071,  defeating their brother García II who was arrested in Santarém and imprisoned in Burgos until he was exiled to the Taifa of Seville, then under the rule of Al-Mu'tamid ibn Abbad.
After eliminating their brother, Alfonso VI and Sancho II titled themselves kings of Galicia and signed a truce that was maintained for three years.

The truce was broken with the Battle of Golpejera on 12 January 1072.
Although Sancho II's troops were victorious, he decided not to persecute his brother Alfonso, who was imprisoned in Burgos and later transferred to the monastery of Sahagún, where his head was shaved and he was forced to wear a chasuble.
Thanks to the intercession of their sister Urraca, Sancho and Alfonso reached an agreement under which Alfonso VI was able to take refuge in the Taifa of Toledo under the protection of his vassal Al-Mamun, accompanied by his childhood friend, the faithful Pedro Ansúrez and his two brothers Gonzalo and Fernando.

Alfonso VI, from his exile in Toledo, obtained the support of the Leonese nobility and his sister Urraca, who remained strong in the city of Zamora, a lordship that Ferdinand I had granted her previously.
When Urraca refused to exchange Zamora for other cities that Sancho had offered her in an effort to control the fortress of Zamora, "key to the future expansion south of the Duero", Sancho besieged the city.
 However, during the siege, Sancho II was murdered.
According to tradition, during the siege a nobleman named Vellido Dolfos appeared before the king, claiming to have changed his loyalty from Urraca to Sancho.
Under the pretense of showing him the weak parts of the city's walls, Dolfos separated the king from his guard and killed him with a spear.
Although there is no clear evidence that Sancho II's death was due to treason rather than deceit, since Dolfos was Sancho II's enemy, his murder occurred in a warlike attack during the siege, not near the city walls, but rather in a nearby forest where Dolfos lured the Castilian king away from his armed protection.
The violent death of Sancho II, who had no descendants, allowed Alfonso VI to reclaim his throne as well as Sancho's and Garcia's original inheritances of Castile and Galicia, respectively.

Although Rodrigo Díaz de Vivar (El Cid), the standard-bearer and confidant of King Sancho II, was present at the siege of Zamora, the role he played in this event is not known.
Neither can Sancho II's death be blamed on Alfonso VI, who, when his brother was killed, was in exile far from the events.
 "nevertheless, the minstrels and ballads filled this void with beautiful literary creations devoid of any historical reality".

It was at this time that the Leyenda de Cardeña concerning El Cid (13th century) was born.

According to this legend, Alfonso VI was forced by El Cid to take an oath to deny that he had been involved in his brother's death, thus giving rise to mutual distrust between them despite Alfonso VI's efforts at rapprocheme
After his coronation in the city of León in January 1066, Alfonso VI had to confront the expansionist desires (although Alfonso would prove himself as having the same or more so) of his brother Sancho II, who, as the eldest son, considered himself the sole legitimate heir of all the kingdoms of their father. The conflicts began after the death of their mother Queen Sancha on 7 November 1067, leading to seven years of war between the three brothers. The first skirmish was the Battle of Llantada, a trial by ordeal in which both brothers agreed that the one who was victorious would obtain the kingdom of the defeated brother. Although Sancho II was the winner, Alfonso VI did not comply with the agreement; even so, relations between them remained cordial as evidenced by the fact that Alfonso was present at the wedding of Sancho II to an English noblewoman named Alberta on 26 May 1069. This was the same event where both decided to join forces to divide between themselves the Kingdom of Galicia that had been assigned to their younger brother García II.
With the complicity of Alfonso VI, Sancho II invaded Galicia in 1071,  defeating their brother García II who was arrested in Santarém and imprisoned in Burgos until he was exiled to the Taifa of Seville, then under the rule of Al-Mu'tamid ibn Abbad. After eliminating their brother, Alfonso VI and Sancho II titled themselves kings of Galicia and signed a truce that was maintained for three years.
The truce was broken with the Battle of Golpejera on 12 January 1072. Although Sancho II's troops were victorious, he decided not to persecute his brother Alfonso, who was imprisoned in Burgos and later transferred to the monastery of Sahagún, where his head was shaved and he was forced to wear a chasuble. Thanks to the intercession of their sister Urraca, Sancho and Alfonso reached an agreement under which Alfonso VI was able to take refuge in the Taifa of Toledo under the protection of his vassal Al-Mamun, accompanied by his childhood friend, the faithful Pedro Ansúrez and his two brothers Gonzalo and Fernando.
Alfonso VI, from his exile in Toledo, obtained the support of the Leonese nobility and his sister Urraca, who remained strong in the city of Zamora, a lordship that Ferdinand I had granted her previously. When Urraca refused to exchange Zamora for other cities that Sancho had offered her in an effort to control the fortress of Zamora, "key to the future expansion south of the Duero", Sancho besieged the city.  However, during the siege, Sancho II was murdered. According to tradition, during the siege a nobleman named Vellido Dolfos appeared before the king, claiming to have changed his loyalty from Urraca to Sancho. Under the pretense of showing him the weak parts of the city's walls, Dolfos separated the king from his guard and killed him with a spear. Although there is no clear evidence that Sancho II's death was due to treason rather than deceit, since Dolfos was Sancho II's enemy, his murder occurred in a warlike attack during the siege, not near the city walls, but rather in a nearby forest where Dolfos lured the Castilian king away from his armed protection. The violent death of Sancho II, who had no descendants, allowed Alfonso VI to reclaim his throne as well as Sancho's and Garcia's original inheritances of Castile and Galicia, respectively.
Although Rodrigo Díaz de Vivar (El Cid), the standard-bearer and confidant of King Sancho II, was present at the siege of Zamora, the role he played in this event is not known. Neither can Sancho II's death be blamed on Alfonso VI, who, when his brother was killed, was in exile far from the events.  "nevertheless, the minstrels and ballads filled this void with beautiful literary creations devoid of any historical reality".
It was at this time that the Leyenda de Cardeña concerning El Cid (13th century) was born.
According to this legend, Alfonso VI was forced by El Cid to take an oath to deny that he had been involved in his brother's death, thus giving rise to mutual distrust between them despite Alfonso VI's efforts at rapprocheme
Alfonso VI of León and Castile