D. Gualdim Pais, son of D. Paio Ramires and D.ª Gontrode Soares, was born in Amares around 1118. He was the brother of D. Gomes Pais, D.ª Sancha Pais and D. Vasco Pais, who was the Mayor of the city of Coimbra and the son of his father’s first marriage with D.ª Ouroana Martins «de Caldelas».
He was raised at court and educated by D. Afonso Henriques, and received his first training at the Monastery of Santa Cruz in Coimbra.
A squire to D. Afonso Henriques, he was the 4th Master of the Order of the Temple, since the Order was established in Soure, in 1128. This Portuguese knight played a very important role in the establishment and expansion of the Order of the Temple in Portugal.
He fought the Moors to conquer the kingdom alongside D. Afonso Henriques, being knighted at the Battle of Ourique in 1139. He played a very important role in the capture of Santarém in 1147 and Lisbon in 1149.
He became a Knight Templar and left for Palestine in 1151 as a Knight of the Order of the Templars, where he fought for 5 years, having participated in the Siege of Gaza in 1153.
In 1157 he was appointed Commander of Braga and Procurator of the Order of the Temple, which at the time was based in Braga.
Between 1159 and 1195, the year of his death, he was Master of the Order of the Temple, elected by the Chapter and by royal will, as successor to the mastership of D. Fr.
During five years of combat and travels in the Middle East, D. Gualdim Pais became acquainted with the most advanced techniques in the construction of castles, built in the Holy Land by the Crusaders, revolutionizing the way of building fortresses in Portugal. D. Gualdim would introduce the alambor and the keep, which appeared for the first time in Portugal in the castle of Tomar.
D. Gualdim Pais founded the castle and the town of Tomar, through the charter of 1162, which became the headquarters of the Templars in Portugal. He founded, ordered the construction and reconstruction of the castles of Pombal, Castelo Novo, Almourol and Monsanto, Ozêzere, Ourém and Idanha-a-Nova. D. Gualdim Pais died in Tomar in 1195 and is buried in the church of Santa Maria dos Olivais, in Tomar, which was the Templar pantheon in Portugal.