The gunman who opened fire on his estranged wife at a San Bernardino elementary school had been married to the special needs teacher less than three months, it was revealed.

Cedric Anderson, 53, walked into a classroom at North Park Elementary School and shot dead his estranged wife Karen Smith, 53, on Monday.

After unloading his revolver, killing Smith and injuring two special needs boys standing behind her, Anderson then turned the gun on himself in the apparent murder-suicide.

Both Anderson and Smith were found dead inside the classroom and one of the students, Jonathan Martinez, eight, later died from his injuries at a hospital.

Police revealed that Anderson and Smith had just been married in late January but separated around a month ago after Smith learned that the man she married 'wasn't wonderful'.

Scroll down for video

Cedric Anderson, 53, opened fire on his estranged wife Karen Smith, 53, before killing himself at North Park Elementary School in San Bernardino, CA. on Monday. They were married in January (pictured) before they separated around a month ago

The couple tied the knot in front of family and friends at Bethesda Temple Church on January 28 in Los Angeles, California (left), and went on their honeymoon shortly after in Sedona, Arizona (right)

Smith (right) reportedly learned that Anderson (left) 'wasn't wonderful' like she thought, causing them to split. Her mother said they had been friends for four years before they were married

Anderson injured two special needs students who were standing behind Smith. One of the boys, Jonathan Martinez, eight, later died from his injuries on Monday. Pictured: The school's 520 other children being evacuated

Smith was a mother to four adult children from a previous marriage, reported the Los Angeles Times.

Her mother, Irma Sykes, told the paper that the two had been friends for around four years before they were married.

Anderson claimed to be a pastor and frequently posted religious things on Facebook but he was revealed to have a lengthy criminal history, with domestic violence, weapon and drug-related charges brought against him, police said.

The seemingly happy couple was married at Bethesda Temple Church on January 28 in Los Angeles, California. They tied the knot in front of loved ones as the guests smiled on.

Their honeymoon was in Sedona, Arizona, where they went hiking and ate steak dinners as Anderson uploaded videos to Facebook kissing his bride.

Smith was a mother to four adult children from a previous marriage. Anderson also had children, but it is not known how many at this time

Police rushed to the scene with SWAT teams and anti-terrorism units as news of the shooting unfolded

San Bernardino police guides children on to the playground as multiple law enforcement agencies responded to the shooting

Also on his personal social media page were frequent posts about Smith, as Anderson proclaimed that she was his 'angel' and that he loved being married to her.

However, something shifted in the relationship and the honeymoon period was quickly cut short around a month ago.

Speaking of her murdered daughter, Sykes said: 'She thought she had a wonderful husband, but she found out he was not wonderful at all. He had other motives.

'She left him and that’s where the trouble began. She broke up with him and he came out with a different personality. She decided she needed to leave him. She was going to divorce him.'

Sykes did not wish to reveal what were the reasons that led Smith 'to pull away' from Anderson.

Anderson was reportedly a pastor and filled his Facebook with religious posts. The man also had a criminal history, with domestic violence, weapon and drug-related charges

Smith's mother said her daughter was planning on divorcing Anderson after discovering he had 'other motives'

Anderson frequently posted about how much he loved his bride, saying she was an angel

According to court records, Anderson was charged with assault and battery with brandishing a firearm and disturbing the peace in Los Angeles County in 2013.

However, all charges were dismissed around a year later, the Los Angeles Times reported.

What happened in the month of separation for the newlyweds was kept quiet, at least until Anderson appeared at Smith's elementary school on Monday morning and told the front desk he needed to drop off something for his wife.

Police said he was known to the staff at the front office, who let him sign in and he began his path towards the special needs classroom that his wife taught.

Anderson stepped inside the classroom of 15 young students and 'very quickly' began shooting his revolver at Smith, all without saying a word, San Bernardino police said.

He unloaded his clip then reloaded once more, before killing himself.

In the horrendous attack, he also injured two students who were standing behind Smith.

Later on Monday it was announced that one of the children, Martinez, had died after he was taken via helicopter to the hospital.

On Monday evening, the Riverside, California, home that Anderson and Smith shared during their brief marriage was cordoned off with police tape.

The home, inside an upmarket gated community, belonged to Smith - who had previously lived in the property with her ex-husband Roderic, 53

Anderson was let into the school after he signed in at the front desk. Police said he was known to the staff

On Monday evening, the Riverside, California, home that Anderson and Smith shared during their brief marriage was cordoned off with police tape

Police SWAT team arrive at the Riverside home of Smith and Anderson. The home, inside an upmarket gated community, belonged to Smith - who had previously lived in the property with her ex-husband Roderic, 53

The other student is a nine-year-old boy, whose name was not released. He survived and is at the hospital in stable condition.

Police arrived to the school less than five minutes after authorities were alerted to the shooting.

All of the 520 students inside the school were rushed out onto the playground as law enforcement stood watch with large guns strapped to their chests.

They were taken to California State University at San Bernardino to be counted by school officials and interviewed by police if necessary.

On Monday evening a service was held to honor the victims killed in the shooting that is believed to have begun as a domestic dispute.

The community held candles and several shed tears and the town was rocked by Monday morning's events.

Betty Rodriguez, right, comforts her granddaughter Giselle, 11, during a prayer service held to honor the shooting victims