In the ideal city, justice is the principle that each class — rulers, guardians, producers — does its own work and does not interfere with the others. Wisdom resides in the rulers; courage in the military class; temperance is the agreement among all classes about who should rule. Justice is what makes all three virtues possible by keeping each in its proper place.
The parallel holds for the individual. The just person is internally ordered: reason ruling, the spirited part supporting it, appetite accepting its authority. Injustice is not merely wrong action but inner disorder — a disease of the soul, the condition in which one part has usurped another's function.
This is Plato's decisive reply to Glaucon's challenge: show that justice is worth choosing even without its rewards. The tyrant, who appears most powerful and free, is actually the most wretched — enslaved to appetite, incapable of friendship or trust, forever tormented by unsatisfied desire. The just person's soul, by contrast, is unified and flourishing. Justice is constitutive of the good life, not merely a means to it.
Justice as psychic harmony is the capstone argument of The Republic Book IV. Plato sees personal morality and political order as two expressions of the same principle — proper ordering of parts within a whole.