The region of Beja was first inhabited by Celtic tribes during the 5th century BC. The area fell under Roman rule in the 1st century BC following a peace pact between Rome and the Lusitanians, and was renamed Pax Julia by Julius Caesar in 48 BC. The town became the capital of the province of Lusitania. During the reign of Augustus the town became known as Pax Augusta. It was during the Roman era that the Evora gate near the castle was built and also some of the original walls that are now incorporated into the castle. After the fall of the Romans the town fell under control of the Visigoths in the 6th century who then called it Paca.
The town fell again in 713 to the invading Muslim Umayyad army and thus Paca, through Arabic Baja, became Beja. From 910 onwards there were successive attempts of reconquest by Christian Kings. When the Umayyad Caliphate collapsed Beja became an independent Muslim ruled principality. In 1150 the town was captured by the Almohads, who annexed it to their North African empire. It was retaken in 1162 by an army under the Portuguese King Afonso I, yet was recaptured in 1175 by the Almohads and stayed under Muslim rule until 1234 when King Sancho II ended the centuries of Moorish rule.
In 1253 King Afonso III began work on reconstructing the fortress walls. In 1307 King D. Dinis ordered the construction of the keep tower. During the 16th and 17th centuries much construction and re-fortification work was undertaken, including the construction of the vaulted ceiling in the keep tower. In the early 19th century the city of Beja opposed Napoleonic troops, and in 1808 forces under General Jean-Andoche Junet killed about 1,200 people in the region. From the 1850s onwards there has been considerable renovation and the castle was declared a national monument in 1910
GPS: 38.01739, -7.86548