Why does Ezra act in this strange manner?

Ezra 9:3 (ESV)

3 As soon as I heard this, I tore my garment and my cloak and pulled hair from my head and beard and sat appalled.

Tearing your garment was a common way of expressed distress or grief (Genesis 37:29, Genesis 37:34; Esther 4:1; Job 1:20; Isaiah 36:22; Jeremiah 41:5; Matthew 26:65). But Ezra pulling out his own hair is unique. In the Bible, normally the head would be shaved to express grief (Job 1:20; Ezekiel 7:17; Amos 8:10) or the offenders’ hair will be torn out (e.g. Nehemiah 13:25).

Ezra’s actions are thus meant to show his utter devastation following the news he has heard about Israel’s unfaithfulness.