The Muslim-hating white supremacist behind February’s deadly shooting rampage in two New Zealand mosques was formally charged with terrorism early Tuesday.

Brenton Tarrant, who allegedly massacred 51 people in a partially livestreamed rampage, was hit with the terror charge more than two months after the April 15 attack.

Tarrant, 28, posted a far-right screed before the killings, which laid out his desire to “create an atmosphere of fear” and to “incite violence” against Muslims.

The terror charge carries a maximum penalty of life in prison and will serve as a test case for terror laws adopted by New Zealand in 2002.

Tarrant was charged with 50 counts of murder and 39 counts of attempted murder following the massacre, but officials on Tuesday tacked on an additional murder charge for a Turkish man who was wounded in the attack and died earlier this month.

With Post wires