I like to think of Yojimbo as generally from the perspective of the Mifune character gazing out at the town; Sanjuro is the perspective of the town gazing in at the Mifune character.
I quite like Yojimbo for the wry amusement Mifune displays in his performance towards all these people caught up in petty feuds and the way that the lives of the two clans (and the town itself, as seen by the thriving coffin trade and regularly timetabled standoffs!) has become completely defined by conflict - into a cycle of tit-for-tat retributative violence that everyone seems happy with. After all if there wasn't constant conflict, what would be the purpose of the clans and the town then - how would it be run and who would provide the jobs?
I think if Mifune's character was truly nihilistic towards the situation he would leave things the way they are, letting the cycle of violence continue. Instead he pushes the rather comfortable situation of mutually assured destruction and attitude to casual violence that the two clans have with each other over the line into total annihilation in order to, in a way, cleanse the town of its cancerous disease.
I agree with Murdoch that Mifune has fun playing the clans off against one another but the moment on the tower comes towards the climax of his methodical way of escalating tensions between either side, edging the two clans towards the full blown conflict that they both pretend that they want but which will be devastating for their symbiotic relationship if they actually do have it. Unfortunately they get saved from having to battle just in time by the news of the Inspector's visit, causing both sides to retreat in order to put on a sham facade of idyllic village life until he leaves and they can get back to business.
It is quite a politically astute film, if you wish to read it that way.
At the same time, Mifune is also methodically decimating
both sides to ensure that neither side gains the upper hand in their war of attrition. He doesn't want to give one side or the other the advantage to destroy their rivals and take over the town completely. He wants them both to be destroyed so that what remains of the village can be saved, and the young men will not see going off to join either gang as the only viable career option open to them, while the young women will not have to become prostituted (But there is a cynical attitude to these young people, since they have, like the victims in Salo in a way, internalised and maybe unconsciously accepted the violent values of their new society as being legitimate).
The appearance of Nakadai and his gun is really what pushes the situation to a head as his alliance will now be the crucial factor in which side could become victorious (shades of Kagemusha). Plus this causes Mifune himself to then lose the element of mystery he as been cultivating as an 'ultimate warrior' who could turn the tide of battle depending on who he allied himself with, which he has been using to manipulate both sides.
I also agree with Murdoch that the ending, after Mifune is victorious, can seem rather abrupt. But I think it is still more devastating for Mifune than the town he leaves behind - he may have decimated the town of its ruling merchant classes but he has removed the cancer at the heart of it. The town may rebuild itself or be too weak to continue and die, but at least it will not pose a threat to the entire area as it once did, threatening to extend its malign influence once the petty local feuds were resolved. Rebuilding is not Mifune's problem though - he has turned the remains of the town into wandering ronin like himself, but at least they have the basic infrastructure and what remains of a previously oppressed population to attempt to remake themselves (even if it is just old men and women left to do that rebuilding now). His acknowledgement of being just as much a part of turmoil and conflict is reflected in the way that he immediately leaves after the final battle and before the town has a chance to move on without providing a place for him (as the samurai characters sadly find happens in Seven Samurai).
To lower the tone a little (but to give a connection to that dog with the severed hand in its mouth!), just like
The Littlest Hobo, his fate is to travel from town to town, righting wrongs and then moving on!
Sanjuro is fascinating for the way in which, instead of trying to push everyone into a decimating, but also morally cleansing, conflict, Mifune's character is trying to preserve the fundamental decency within the system. To use a broad medical analogy again instead of the need for a drastic amputation of a diseased limb to save the patient, here Mifune needs to be a surgeon delicately applying pressure (and bloody violence!) to specific areas before the rot becomes too widespread. That takes the form of (foreshadowing Red Beard) gruffly disabusing people of wrong attitudes they may form and instead judging based on actions and motivations rather than purely on appearances.
The ending of Sanjuro is perhaps even more devastating for Mifune than the ending of Yojimbo, since he has spent the whole film helping the characters to take more control of their lives and their town back from corrupt officials, and instead of leaving a devastated but cleansed town he instead leaves a healthy town behind. The final battle is not just a gory highlight but it also acts as a reaffirmation of Sanjuro as being the essentially violent samurai that has no place in a society not driven by conflict, something that has been easy to forget during the course of this film as Mifune has played with handfuls of flowers at points.
It highlights Mifune’s masculine skill in combat (with the almost ejaculatory burst of blood after the prolonged standoff a fitting climax) and the character's essential appeal to the youthful men looking for, and moving between, various male role models throughout the film (with the suggestion that despite what they have taught in the rest of the film that this kind of display of masculine power may still retain a hold on them, maybe leading them to ‘unsheath their swords’ in emulation one day). It is a homoerotic ending in a way that goes far beyond just sex.
Interestingly the final scene can be read a number of ways - as traumatising his group of acolytes with a vision of real death, or as undermining the non-violent message to the rest of the film by ending with such a moment of masculine power through violence. It can also be seen as embarrassing to Sanjuro to have the image he has projected throughout the rest of the film so fatally undermined by his acolytes witnessing such a conflict at the very last possible moment. Does it destroy their hero worship or fatally compound it?