|If you wan to see moore history from Castelldefels, look here from Catalan, or here from Spanish|
It is unknow if Castelldefels was originally an advanced military observation point, a place where a small community of monks was established (which happened in some frontier areas), or a settlement of a small group of farmers who needed land to cultivate, sometime around the IX or X century. However, in 996 the first document refering to the church of Santa María appeard, and a year later, another donation deed to she smail church in the castle, where we find for the first time the name"Kastrum Felix".
Therefore, by the end of the X century there is a church, a religious community, a castle and a number of farmers. In those days, the castle was a small building (pre-romanic) with a latin cross share. Religiously it is dependent on the monaster of Sant Cugat, but during twenty years it administrated on its own.
After the "Razzies" of Al-Mansur, Borrell II decided to donate the territories of the south Llobregat area to Sant Cugat, therefore, the church of Castelldefels which up to then had increased its possessions through donations from the farmers, from whom it received part of the marvest and charged them for using the windmill of "La Sentiu", became one of many possessions of the inheritance of a big and distant monastery.