sentence1: On one hand, their revenge was perfectly in accord with the samurai code of honor; on the other, they had murdered a high official.
sentence2: They killed a high official, but did so within the samurai code of honor.