The man who shot dead a mother, her child, and injured two other children before killing himself in a Salt Lake City suburb had shared a number of threatening posts on social media in the days leading up to the shootings.

Jeremy Patterson shot and killed Memorez Rackley - a married woman who he had been in a relationship with - and her six-year-old son Jase in Sandy, Utah, in a targeted attack on Tuesday afternoon as they walked home from an elementary school.

Rackley's 11-year-old son Myles was critically injured, and a good Samaritan's daughter was also injured in the attack, which ended with Patterson turning the gun on himself.

The shooting came three days after 39-year-old Rackley, who was married, called in a harassment report to police early Saturday morning and asked them to tell Patterson, a bodybuilder, to stop contacting her, said Sandy police Sgt Jason Nielsen.

Jeremy Patterson (left) shot and killed Memorez Rackley (right) - a married woman who he had been in a relationship with - and her six-year-old son (right, in red) in Sandy, Utah, in a targeted attack on Tuesday afternoon as they walked home from an elementary school. Rackley's 11-year-old son (right, in yellow) was critically injured in the attack

Nielsen declined to say what the outcome of that conversation was, or detail the nature of the harassment.

Patterson shared a number of threatening Instagram posts in the days leading up to the shooting.

One photo posted two days before the shooting featured the menacing clown from the Saw films, Jigsaw, with the quote 'Let the games begin'. The Instagram post had 15 likes.

He captioned the photo: 'My ex thinks she can Control even when we aren't together!!!! Let the games begin b****!!'

Another post, shared just a day before the shooting, showed a meme of a young child with the quote, 'I could tell you but... It's a secret!' The post was liked by 19 people.

He captioned the post: 'How can someone love you so much and keep you such a secret?? After 6 months, I never met her friends, family or kids!!! I don't think anyone deserves to be kept secret. I love Memorez Rackley and she's never been a secret in my life!!'

The shooting came three days after Rackley, who was married, called in a harassment report to police Saturday morning and asked them to tell Patterson, a bodybuilder, to stop contacting her, said Sandy police Sgt Jason Nielsen. Patterson shared a number of threatening Instagram posts in the days leading up to the shooting

Another post, shared just a day before the shooting, showed a meme of a young child with the quote, 'I could tell you but... It's a secret!' The post was liked by 19 people

Patterson shared another post to his Facebook page in which he expressed his love for Rackley and his disappointment over her keeping their affair secret.

He wrote: 'Not sure why Instagram pulled this pic!! Maybe a shirtless guy is against the ethics code or maybe Memorez Clark Rackley doesn't want the world to know that she cheat on her husband with me??

'It's really sickening when you love someone and they keep you a secret in this world!! When I love, I'm proud, I wanna show my love to the world!!!

'Anyway... this is my proud moment and I own this picture and I will keep posting!! When you lose someone after 6 months is hurts and this pic reminds me of all the good times we had together!!!! I know I will never feel that love again!!!'

He tagged the post with a number of hashtags, including '#mensphysique', '#relationship', '#cheaters' and '#leavetheuglybehind'.

Authorities say married Rackley and bodybuilder Patterson were or had been in some sort of relationship and that the killings they described as targeted happened Tuesday afternoon just after Rackley picked her boys up from elementary school.

Authorities say married Rackley and bodybuilder Patterson were or had been in some sort of relationship and that the killings they described as targeted happened Tuesday afternoon just after Rackley picked her boys up from elementary school. Rackley is pictured with her sons above

The extent and nature of Rackley and Patterson's relationship and the motive for the shooting remained unclear on Wednesday as detectives probed leads, police say

Rackley was married to another man at the time of the shooting. Patterson, pictured, was not the father of her children

Rackley was walking about six blocks from the school when she flagged down a driver.

The unidentified female driver picked up Rackley and her boys but her car was then rammed by a pickup truck driven by Patterson, who got out and opened fire.

Also shot and injured was the driver's daughter, said Nielsen. Patterson then killed himself.

The unidentified driver then ran to a nearby house and pounded on the door. Resident Kathy Peterson found the hysterical woman and three young girls cowering, one of the girls covered in blood.

She had heard gunshots as she opened the door and brought them inside to safety.

'He's killing everybody and he's trying to kill us,' the terrified woman told Peterson through tears.

The extent and nature of Rackley and Patterson's relationship and the motive for the shooting remained unclear on Wednesday as detectives probed leads, Nielsen said.

Rackley was married to another man but Nielsen did not provide more details. Patterson was not the father of her children, he said.

A memorial has been set up near the elementary school in Sandy, Utah, where Rackley and her son here killed

Ava Linsenmeyer, 5, drops off balloons to a memorial for the victims of the fatal shooting on Wednesday

Rackley family spokesman Jeff White said he didn't know the exact nature of the relationship between Rackley and Patterson.

He declined to elaborate on the state of the Rackley's marriage but said 'they both loved each other very much and they were husband and wife'.

Rackley's husband is doing as well as can be expected for someone dealing with the loss of the mother of his children as well as his youngest child, with another son fighting for his life, said White, who has been a family friend for 30 years.

'She was an amazing mother, she's beloved by all her friends and family ... just totally adored by the whole community,' White said about Rackley.

Nielsen said investigators are still trying to determine if the woman who picked up the family just happened to see them or knew them.

Peterson said the woman who showed up at her door said she was driving her two daughters and another girl home from the same elementary school when Rackley flagged her down asking for help.

Crime scene investigators go over one of the vehicles involved in the deadly Sandy shooting

Police and emergency personnel look over the scene after a deadly shooting in Sandy, Utah

Police officers investigate the scene of a shooting in Sandy, Utah near an elementary school

After getting the woman and children inside, Peterson said she said a prayer and gave the girls teddy bears until paramedics arrived to take the mother and her daughter to the hospital.

The girl was shot in the leg and was hospitalized Wednesday stable condition, Nielsen said.

The suspect lived in the nearby suburb of Draper, where neighbor Patricia Briennieson described him as a muscular man who looked like a bodybuilder and had a mixed-martial arts sticker on the back window of his pickup truck.

Court records did not show previous criminal charges or requests for protective orders filed against Patterson.

In the quiet neighborhood with winding roads and homes nestled near mountains, the shooting happened on the day before the last day of school.

The school, Brookwood Elementary at 8640 Snowbird Drive, was locked down for an hour following the shooting. At the time, there were only about a dozen children left inside the school, said police.

Community members look on as police officers investigate the scene of a shooting in Sandy, Utah, Tuesday. Witnesses initially said it looked to be a domestic incident

Brookwood Elementary School in Sandy was briefly put under lockdown following the shooting

On Wednesday at the Brookwood Elementary School attended by the children who were shot, teachers tried to keep the final day before summer as normal and festive as possible.

But there was a significant police presence and a sign fashioned out of blue and red plastic cups on the school's outside fence offering love for the boy in critical condition.

Myles Rackley remained hospitalized two days after the shooting, though he's slowly recovering, White said.

The boy, who White said is 11, suffered the brain aneurysm of natural causes without warning last year.

"It just happened. It was extremely terrifying," White said. "He's kind of like a little walking miracle."

The boy missed his fifth grade graduation Wednesday, so the students, teachers and parents read his name aloud and gave him a standing ovation, said classmate Chloee Walker.

Counselors were at the school to help students and parents deal with the aftermath of the shooting.

Toni Linsenmeyer's daughter was in Rackley's six-year-old son's school class and played on the soccer team, which was coached by Rackley's husband.

She said Rackley and her husband had been separated but that both attended all of their son's soccer games in the spring.

'It breaks my heart,' Linsenmeyer said.