הַהוּא גַבְרָא דְּקָא מְצַלֵּי אֲחוֹרֵי בֵּי כְּנִישְׁתָּא, וְלָא מַהְדַּר אַפֵּיהּ לְבֵי כְּנִישְׁתָּא. חֲלַף אֵלִיָּהוּ. חַזְיֵיהּ, אִידְּמִי לֵיהּ כְּטַיָּיעָא, אֲמַר לֵיהּ: כְּדוּ בָר קָיְימַתְּ קַמֵּי מָרָךְ?! שְׁלַף סַפְסֵרָא וְקַטְלֵיהּ.
To reinforce the gravity of this prohibition, the Gemara relates: A certain individual prayed behind the synagogue and did not turn to face the synagogue. Elijah the Prophet passed by and appeared to him as an Arab [taya’a]. Elijah said: “This is how [kadu bar] you stand before your Master?” Elijah drew a sword and killed him. (Berakhot 6b)
Rav Huna says that someone who prays behind the shul is wicked and then Abayey clarifies that this is only when a person also faces away from the shul. This is then followed by the story of Eliahu HaNavi brought here. So I understand from the genera that this is a wicked person based on his actions but what makes him deserving of the death penalty?