mid-12c., "the exercise of authority in vindication of right by assigning reward or punishment;" also "quality of being fair and just; moral soundness and conformity to truth," from Old French justice "justice, legal rights, jurisdiction" (11c.), from Latin iustitia "righteousness, equity," from iustus "upright, just" (see just (adj.)).
Justice is the end of government. It is the end of civil society. It ever has been and ever will be pursued until it be obtained, or until liberty be lost in the pursuit. ["The Federalist," No. 51]
Meaning "right order, equity, the rewarding to everyone of that which is his due" in English is from late 14c. The Old French word had widespread senses including also "uprightness, equity, vindication of right, court of justice, judge." In English c. 1400-1700 sometimes also with a vindictive sense "infliction of punishment, legal vengeance." As a title for a judicial officer, c. 1200. Justice of the peace is attested from early 14c. To do justice to (someone or something) "deal with as is right or fitting" is from 1670s. In the Mercian hymns, Latin iustitia is glossed by Old English rehtwisnisse.