Premise: But the unrest they inspired prompted the Tokugawa government to move them all here, to a guarded compound on the village flats ostensibly to guarantee their safety, but more importantly to contain the contamination of their uncouth ways and ideas.

Hypothesis: The Tokugawa government moved them purely to guarantee their safety.
Relation: contradiction