The state prosecution on Wednesday charged a teenager who allegedly carried out a bus bombing in Tel Aviv in November with multiple counts of attempted murder, as well as aiding an enemy during wartime.

Muhammad Mafarji, 18, from the Galilee town of Taibe, was charged at the Tel Aviv Magistrate’s Court with planting an explosive device on a No. 142 bus, injuring 27 people, on November 21, the last day of Israel’s Operation Pillar of Defense against terror factions in the Gaza Strip.

Mafarji, a West Bank Palestinian naturalized through a family reunification procedure some 15 years ago, has Israeli citizenship and can therefore be tried in Israeli civil courts. The charge of assisting an enemy during wartime can carry up to a life sentence.

Investigators pieced together the course of events that allegedly made a terrorist of the teenager and led to the bus bombing in the heart of Tel Aviv.

According to the indictment, two months before the attack, Mafarji, who worked at a McDonald’s restaurant in the central city of Modi’in, went to live with his uncle in the West Bank town of Beit Lakia while he was studying at Birzeit University, near Ramallah.

On the sixth day of the eight-day-long Pillar of Defense, Mafarji, while out shopping in Beit Lakia, declared that he wanted to fight alongside Hamas in Gaza. A store owner, Ahmed Moussa, told him to come back later so that they could discuss the matter further, the prosecution said.

When Mafarji returned, the two allegedly began to plot an attack. Moussa first told Mafarji to leave a bag on a bus as a test run, which he successfully completed.

The night before the actual attack the two discussed siding with Gaza, halting the IDF attacks on the coastal enclave, and avenging the death of Hamas military commander Ahmed Jabari, who was killed in a drone strike that marked the onset of the Israeli campaign to curb rocket fire from Gaza. Moussa also allegedly questioned Mafarji about Israeli officials that he knew and promised to provide him with a gun so that he could kill Israelis.

Moussa prepared a bomb that could be detonated by cellphone and hid it in a bag of clothes. He then took Mafarji to the checkpoint at Harbata, where the teenager crossed from the West Bank into Israel to meet with the manager of the McDonald’s where he worked. As the two drove to work, Mafarji was said to have faked a phone call in which he claimed to learn that his mother was ill and that he needed to go back to her. After alighting from the vehicle with the bomb he took a bus to Tel Aviv.

Once inside the city he boarded a No. 142 bus and armed the bomb. When the bus reached the area near the diamond exchange district, Mafarji got off, leaving the device under the third seat. He quickly called Moussa to tell him the bomb was in place, whereupon the latter detonated the device via his cellphone.

After the explosion, Mafarji took a train back to Modi’in and calmly reported for work. He was arrested four and half hours after the attack.

Mafarji’s defense team, attorneys Vajidi Juljuli and Ihab Juljuli, said that while Mafarji’s confession tied him to the event, it was not clear their client was aware of the nature of the bomb he planted.