Ahmed Hassan, 15, a student at the school also died after attack

When killer began slashing sword at pupils, he stepped in between them

Lavin Eskandar, 20, became the first victim of the terror attack in Sweden

The Swedish school murderer who killed a teacher and pupil with a sword during a brutal attack on Thursday, left a suicide note where he wrote that he 'had to do something about immigration'.

Police have said the letter written by Anton Lundin-Petterson, is additional proof that the attack on the school in Trollhattan, near Gothenburg, was a racist hate crime.

As the 21-year-old assailant moved through the school on his bloody rampage which left two dead and two seriously injured, he picked out his victims based on skin colour.

Killer: Anton Lundin-Petterson, 21, posed for this picture with two young female students moments before he stabbed a second teacher in the attack in Trollhattan, Sweden, on Thursday

School killer: Lundin-Pettersson, pictured in high school, left a suicide note where he wrote that he 'had to do something about immigration'

Swedish police today confirmed that the letter found in Lundin-Pettersson's home proves that the attack was a planned racist hate crime and that he acted alone.

'It was a kind of suicide note, I believe the letter was hand-written,' head of investigation Thord Haraldsson told a press conference earlier today

'He writes that he has to do something about the immigration politics in Sweden.;

When asked if Lundin-Pettersson made clear in his letter that he did not intend to survive the attack, police said that it 'can be interpreted that he thought he was going to die'.

Security footage from the school in Trollhattan, north of Gothenburg, shows Lundin-Petterson marching through school corridors armed with a sword and a knife, and stopping to talk to light-skinned students.

'He selected his victims and attacked the dark-skinned ones and left the light-skinned ones alone,' Haraldsson said today. 'Everything points to this being a hate crime.'

Terrorist: Anton Lundin-Petterson, 21, who was shot by police, had expressed sympathies with extreme right-wing organisations online and Swedish police confirmed today that the attacks were racially motivated

Hate-crime: Police believe that Lundin-Pettersson, pictured in another school photograph, had not intended to survive his killing spree at the school in Trollhattan

Brave: Lavin Eskandar, 20, was cut down when he stepped in to protect pupils from killer Anton Lundin-Petterson, who launched an attack on a school in Trollhättan, north of Gothenburg, in Sweden on Thursday

Tributes: Flowers and candles left the scene on Thursday night as it emerged that both Mr Eskandar, 20, and student Ahmed Hassan, 15, had died from their wounds

As he launched his attack on the students, Lundin-Petterson, who was described by a witness as 'wearing a Darth Vader mask', shouted 'I am your father' during his killing spree, a witness has revealed.

Hero: Witnesses have described how Mr Eskandar threw himself between the killer and students

The killer who posed for a photograph with unwitting students midway through his rampage, said the famous Star Wars character's line as he slashed at children.

Earlier today, survivors praised the first victim of the attack - 20-year-old teaching assistant Lavin Eskandar, who was cut down after throwing himself in front of a group of young pupils.

Witnesses say he screamed at the children to run before trying to overpower Lundin-Petterson who, armed with a sword and knife, went on to stab two 15-year-old students and a teacher.

Several students who witnessed the attack at the school in Trollhättan have described Mr Eskandar as a hero who gave his life for them.

Mr Eskandar had been sat by a computer in the school cafeteria when Lundin-Pettersson, wearing a black coat over his shoulders, a helmet and mask, raised his sword and went for a number of students.

Witnesses have described how the brave 20-year-old threw himself between the killer and students to try to stop him.

Mr Eskandar's family has paid tribute to him today, calling him 'a king and a hero in the eyes of the entire city.'

'All I know is that he cared about others, not about himself and that he tried to protect the children. He was the only person who succeeded in stopping the culprit,' his brother Leith Eskandar, 22, told Expressen.

Mr Eskandar, who graduated from a local high school in June this year with a diploma in media studies, had recently begun working as an assistant to one of the students at Kronan school in Trollhattan.

He dreamed of becoming a director and photographer and ran a production company with his brother and a friend, making videos that has millions of YouTube views.

In addition he worked as a local night-club snapper and has been described by friends and family as dedicated, hard working and loved.

Chaos: Family members fight police to try to get access to the school as hundreds of students remained inside in the first hours after the attack

Shock: Students pictured leaving Kronan in the wake of the attacks which have shocked Sweden to the core

Lundin-Petterson's second victim, Ahmed Hassan, 15, who died in hospital on Thursday afternoon, had arrived in Sweden with his parents and eight siblings from Somalia in 2012.

The other student victim, also 15, had fled Syria with his family and arrived in Sweden nine months ago.

He is currently in critical but stable condition and medical staff told Swedish media that the is no longer 'hovering between life and death'.

A witness told Expressen that Lundin-Pettersson had uttered the phrase 'I am your father', in English as he attacked.

Swedish police have now confirmed that the brutal attack was a racist hate crime and a terror attack.

On Friday, at least two schools in Gothenburg, just 45 miles south of Trollhattan received threats in connection with the attack.

Staff at one of them, Grevegårdsskolan, a primary school, found threatening posters when they arrived this morning.

The posters show a picture from the attack on Thursday, although police have not revealed which one, captioned 'I'm back'.

After cutting down Mr Eskandar, Lundin-Pettersson, moved through the school but before word had spread of the attacks, many students thought he had dressed up as a Halloween joke and approached him.

Investigation: Police officers guard the apartment building where Lundin-Petterson used to live as it is revealed that the killing spree had 'political motives' and was a racist hate crime

Forensic officers investigate at a primary and middle school in Trollhattan after the incident

A forensic officer investigates the scene where two teachers and two pupils were stabbed at a school in Sweden

Two young girls even asked him to pose for a picture, and despite having already murdered Mr Eskandar, Lundin-Pettersson paused to do so.

Wearing a mask and holding a sword already covered in Mr Eskandar's blood, the image sees him stand next to two young students,

In a chilling move, Lundin-Petterson even has his arm around one of them, seconds before stabbing a teacher, who remains in critical condition.

The anonymous girl who took the photograph told Swedish newspaper Aftonbladet that they had no idea that the blood on the large sword he was holding was real.

She told the newspaper that she had left her classroom to fetch a pen when she spotted two friends standing with a man wearing a mask and holding a blood-covered knife.

Thinking that the attacker had dressed up as a holiday joke, her friends wanted a picture with him, so she obliged.

Seconds after the picture was taken, their teacher, a 41-year-old maths lecturer, came out of the classroom and told the killer to take off the mask and leave as he was scaring the children.

'He just nodded, then he plunged the large knife into the teacher's right side. The last thing I heard him say was 'call an ambulance'.'

Sword attack: One teaching assisstant and one student died in the wake of the attack, one young boy and a second teacher is still in critical condition in hospital

Parents and children walk away from the school as crowds gather to learn more about the attack

Kronan is located in an area of Trollhattan with a diverse population and many of the pupils are first or second generation immigrants.

In the weeks before the attack, Lundin-Pettersson, who was described by witnesses as wearing a 'Darth Vader mask and helmet', had expressed sympathies with extreme right-wing organisations online.

An investigation by magazine Expo into Lundin-Petterson's social media activities found that he had 'liked' several YouTube videos glorifying Nazi Germany.

He had also showed support for anti-immigration party Sweden Democrats, and other right-wing politicians on Facebook.

He attended Lichron Teknikgymnasium, a high school in Trollhättan where he obtained a diploma in technology.

Police arrived at the scene shortly after 10am and were forced to shoot the 21-year-old attacker after he turned on police.

The assailant used 'a number of knife-like weapons' to attack students and teachers in the school cafeteria and in classrooms.

'One of my friends opened the door and there's a man dressed in black with a Star Wars mask and a large black sword,' a student witness told Sveriges Television.

Racist attack: The 21-year-old had 'expressed right-wing and Nazi sympathies' online in the weeks before the attack at the school, which is located in an area of the city with a large immigrant population

Two people light candles in memory of Lavin Eskandar and Ahmed Hussein who were killed in the attack

Swedish emergency services at the scene after a masked man attacked people with a sword at the Kronan school in Trollhattan in western Sweden

The victims and the masked attacker were all rushed to the Norra Alvsborgs Lanssjukhus hospital in Trollhättan, an industrial town of around 50,000 inhabitants.

Speaking at a press conference on Thursday afternoon, police addressed speculation that the attack had racial motives.

'It's in the picture[potential racist attack], but it is nothing I wish to comment on at the moment,' Thord Haraldsson, who is leading the investigation said.

The wounded teacher had been stabbed in the abdomen while the boys were stabbed in the abdomen, liver and chest.

The attacker, who was also admitted to the Norra Alvsborgs Lanssjukhus, had gun wounds to the lower part of his chest, and later died from his wounds.

Kronan has around 400 students from pre-school, aged six, up to year 9, aged 15-16, but the murdered is not a former pupil.

The victims and the masked attacker were all rushed to the Norra Alvsborgs Lanssjukhus hospital in Trollhättan, an industrial town of around 50,000 inhabitants

Panic: Families and relatives wait outside the school as students were kept inside by police for safety reasons

Police responded to an emergency call saying a masked man equipped with a sword was on the premises and that a person had been attacked at or near the school cafeteria, police said

Speaking at a press conference on Thursday afternoon, Tomas Fuxborg of Västra Götaland Police called the attack 'one of the worst events in Swedish history'.

Swedish Prime Minister Stefan Lofven, who was heading to Trollhattan, described Thursday as a 'black day.'

'My thoughts go out to the victims and their families, the students and staff, and the whole community that has been affected,' Lofven said.

'No words can describe what they are going through right now.'

King Carl XVI Gustaf of Sweden has also made a a statement in the wake of the attack:

'Sweden is in shock. It is with great dismay and sorrow that my family and I have received the news about the events in Trollhättan.