Among other important responsibilities of a medieval king was the oath taken by him of the dispensation of justice and enforcement of law in his kingdom.
The court travelled with the king wherever he went. The king would seek advice from the wise (hopefully) men of his court which would include relatives, barons, lords, and members of the church such as bishops.