Purity
comes by Guarding the 3 Doors of Action:

Friends, there are these three purities:
Purity of
Mental Action!
Purity of Verbal Action!
Purity of
Bodily Action!
Herein, what is purity of bodily action?
It is complete avoidance of all killing of any breathing being, avoidance of
taking
whatever is not freely given, and refraining from any misbehavior in
sense
desires.
Herein, what is purity of verbal action?
It is
total avoidance of all false lies, avoidance of all aggressive speech,
shunning
all divisive slandering speech, and refraining from all idle and
empty hear-say gossip..
Herein, what is purity of mental action?
It is non-envious non-greediness, kind and gentle good-will,
and Noble Right
View...
These 3 behavioral purities are:
Like the earth in property: A firm footing to those, who desire
Freedom..
Like water are they, for they wash away all the stains of mental defilement..
Like fire are they, for they burn the whole forest of the mental obstructions..
Like wind are they, for they blow away all the dust of mental obscuration..
Like a ship are they, for they ferry those, who desire Peace across this
Samsara..
Like a shelter, for they restore Faith in those frightened by Ageing
and
Death..
Like a guide are they, leading any wishing ease out of the jungle of wrong
views..
Like a mirror are they, making any who want Bliss to see the Clusters of
Clinging..
Like an umbrella, warding off incessant scorching of Greed, Hate
and Ignorance..
Like the sun are they, for they dispel
the darkness
and gloom of Deluded
Confusion..
Who fully guards his speech, and is well controlled in mind,
Who does nothing disadvantageous through the
body's door,
Who purifies this
simple triple course of all
acted-out behaviour,
Will win both the path and the fruit, that all the
ancient Seers have enjoyed!

More on Mental Purification
(Visuddhi):
Mental_Purity,
Levels of Leaving Behind,
The_7_Purifications,
The_purpose_of_purification,
The_7_stages_of_Purification,
Ability_Purification,
The_8_Understandings,
Immaculate_Integrity.

The Absolute Mental Manual:
The Path of Purification.
Visuddhimagga.
Excellent if not legendary translation by
Bhikkhu
Ñānamoli
(1905-1960).
Written by 'The Great Explainer'
Buddhaghosa
on 5th century Ceylon:
http://What-Buddha-Said.net/library/pdfs/PathofPurification2011.pdf