The word ‘צדק’ (Tzedek), ‘justice’ is an aspect of Malchut and represents judgment without mercy. The word ‘משפט’, ‘Trial’ is on the level of Zeir Anpin that include mercy.
When there is a great Tzadik in the world that is loved by the Holy One Blessed be He, the world can be saved because of him, even when there is a judgment (צדק) without mercy (משפט). The Tzadik has this power because the Holy One Blessed be He wants to honor him.
When such a Tzadik can not be found in the world, everyone fears the judgment even if it comes with mercy.
King David was righteous and the chariot for Malchut. In the beginning, he didn’t fear judgments, even from the aspect of ‘צדק’’ Justice’.
“בְּחָנֵנִי יְהוָה וְנַסֵּנִי צרופה [צָרְפָה] כִלְיוֹתַי וְלִבִּי.”
“Examine me, O YHVH, and prove me; Try my mind and my heart.”
And Psalms 17:15
“אֲנִי בְּצֶדֶק אֶחֱזֶה פָנֶיךָ אֶשְׂבְּעָה בְהָקִיץ תְּמוּנָתֶךָ.”
“As for me, I will see Your face in justice (צֶדֶק); I shall be satisfied when I awake in Your likeness.”
After King David sinned he had the fear of been judged even by the aspect of mercy, ‘מִשְׁפָּט’. We read this in Psalms 143:2
“וְאַל תָּבוֹא בְמִשְׁפָּט אֶת עַבְדֶּךָ כִּי לֹא יִצְדַּק לְפָנֶיךָ כָל חָי.”
“Do not bring into judgment (מִשְׁפָּט Trial) Your servant, For in Your sight no one living is righteous.”
When ‘צדק’ ‘Justice’ merge with ‘משפט’’ Trial’, Malchut receives Chassadim from Zeir Anpin and Chessed spreads in the world. This state is called ‘צדקה’ ‘Tzedakah’ because as a receiver, Malchut that is represented with the letter ‘H ה’ of the name, filled with Light of Chassadim and becomes part of ‘צדק’ (Tzedek).
“אֹהֵב צְדָקָה וּמִשְׁפָּט חֶסֶד יְהוָה מָלְאָה הָאָרֶץ.”
“He loves righteousness (Tzedakah צְדָקָה) and justice; The earth is full of the goodness of YHVH.”
Malchut doesn’t have light of its own and judgment on this level is just and harsh. Zeir Anpin is the center column and reveals the light of Chassadim, therefore judgment that comes from this level is merciful.
Our studies elevate us to Zeir Anpin and above, and when we experience judgment it is something that we need to help us in our correction process.
When we don’t have this light, judgments come harshly, even without connection to our Tikun.