The pine forest was initially ordered to be planted by King Afonso III (1248-1279) in the 13th century, with the aim of halting the advance and degradation of the dunes, as well as protecting the city of Leiria and its Castle and the agricultural land from degradation due to wind-blown sand, which had become a major concern for the inhabitants of the region. It was then later, between 1279 and 1325, substantially expanded by King Dinis I to its current size. This involved sowing an extensive area along the coast, especially using maritime pine. Some authors even attribute the beginning of the planting of the Leiria pine forest to King Sancho II (1223-1248).
Whenever trees were cut down, replanting followed – in this way the pine forest remained intact. Since at least the last quarter of the 15th century, the position of Chief Warden of the King's Pine Forests or Royal Pine Forests of Leiria, Guard and Warden of the King's Pine Forests, was hereditary in the