In 988, when the Count or Urgell gave the land to the local Bishop.