Yan dynasty is very oppressive to people different than them
Most of the warriors of these tribes commit crime even if they do not want to.
The crime is simply being alive.
The Yan dynasty could easily pin a blame to some "barbarians" when there is killing in the border.
Or they would rape woman of the tribes and blame it on something else.
There is many such stories where a warrior of the tribes would kill an official of the Yan dynasty
This is because even if these people lived in Yan dynasty and wanted to follow the law, the law does not answer to them
Even in the future, the law is simply the restriction the ruling class put on the lower classes, it is even more so in an era, in a regime where the imperial power is put above all
Even Yan dynasty own people rarely even file a suit.
