It was created as a result of Robert the Bruce granting the cities Great Charter in 1319, after they sheltered him during his days of outlaw.
The document emerged from Robert the Bruce's act of granting the cities' charter in 1319, as a result of their kindness and protection he received while he was on the run.