This story was reported by John Asbury, Robert E. Kessler and Paul LaRocco. It was written by Zachary R. Dowdy.

SAN BERNARDINO, CALIF. — Syed Rizwan Farook had contact with people linked to terrorist organizations overseas, and his wife, Tashfeen Malik, pledged allegiance to an Islamic State leader in a Facebook posting shortly before the couple went on a shooting rampage, sources said Friday.

The FBI formally announced it was investigating the Wednesday holiday party massacre at San Bernardino’s Inland Regional Center as an act of terrorism.

FBI Director James Comey said there were indications that the killers had been “radicalized” and drew inspiration from foreign terrorists, but no evidence had emerged so far linking them to a “cell or network.”

Federal agents have conducted more than 300 interviews in the investigation into what motivated Farook, 28, and Malik, 27, to kill 14 people and wound 21 others — many of them Farook’s colleagues at the San Bernardino County Health Department, sources said.

Investigators are being aided by resources of the CIA and the National Security Agency, which tracks and tries to monitor and record communications of suspected terrorists.

Shortly before the rampage, Pakistan-born Malik pledged her loyalty to the head of Islamic State, Abu Bakr al-Baghdadi, in a Facebook posting, the sources said.

advertisement | advertise on newsday

Farook has had some communication with at least five people in the United States and overseas who are believed to be associated with terrorist organizations. The five had been under some loose FBI scrutiny but were never charged with any crimes, the sources said. The organizations included the Nusra Front, an Al-Qaeda-affiliated group in Syria and Shabab, an Islamist group in Somalia.

Despite the carnage the couple created, a leading theory is that they were lone wolves who radicalized themselves.

The pipe bombs they left behind were relatively unsophisticated and failed to explode, the sources said. The devices had a type of construction that could be found many places on the Internet or in INSPIRE, the online magazine of Al-Qaeda in the Arabian Peninsula.

“We are now investigating these horrific acts as an act of terrorism,” David Bowdich, assistant director in charge of the FBI’s Los Angeles office, said at a news conference in San Bernardino Friday, citing evidence of “extensive planning” for an attack.

Bowdich said investigators have recovered two cellphones which the couple had crushed and discarded, and were culling information from the devices.

@Newsday

The specter of terrorism ties — especially to international actors known for their brutality — gave the investigation into the shootings a new focus Friday as authorities scrambled to determine whether the couple had planned to carry out more attacks and were involved with others.

After the massacre, Farook and Malik were shot and killed in a fierce firefight with police in the nearby city of Redlands.

A Facebook official told The Associated Press that Malik praised the leader of Islamic State, also known as ISIS, in a post at 11 a.m. Wednesday, just before the couple attacked the center. The official, who spoke on condition of anonymity because the person was not allowed to be quoted by name, said the company discovered the account Thursday.

Facebook removed the profile from public view and reported its contents to law enforcement, the official said.

“Right from the start, the FBI was pursuing this as terrorism,” Rep. Peter King (R-Seaford) said Friday. “Early on they knew he had been in contact with people under FBI investigation.”

advertisement | advertise on newsday

King, chairman of the Homeland Security Subcommittee on Counterintelligence and Terrorism, said he received a nonclassified briefing on the investigation from the FBI on Thursday night.

King said federal agents were investigating both domestic and international contacts with the couple to determine if a series of attacks was being planned.

“The larger issue is concerning whether they were acting alone and if these murders are part of a cell in a coordinated series of attacks,” he said. “Or this may have been two people who did this on their own. All this is being looked at.”

The couple’s online correspondence was found to be inspirationally based rather than directed at a specific terrorism plot, King said.

Comey said investigators are “going through electronic evidence” the killers attempted to destroy, searching for more clues to their motivations, which remain undetermined.

advertisement | advertise on newsday

“There’s a lot of evidence in this case that doesn’t make sense, so we are trying to understand it,” he said.

The discovery of the large cache of weaponry in the couple’s Redlands town home after their deaths gave new insight into how officials said the couple pulled off the worst mass shooting since Adam Lanza shot and killed 20 children and 6 adult staff members at an elementary school in Sandy Hook, Connecticut in December 2012.

During an extensive search of Farook and Malik’s $1,200-a-month rental home, the FBI seized computers and electronics owned by the couple, along with thousands of rounds of ammunition and bomb-making materials.

Reporters allowed to enter the home later, saw tapestries with Arabic lettering on the walls and a Quran on a coffee table in the living room. There were also plenty of signs of the couple’s 6-month-old daughter: boxes of diapers were piled in the hallway.

The seized pipe bombs were unsophisticated and crude, similar to explosive devices used in the 2013 Boston Marathon bombing, sources said.

Farook worked as a county health inspector and attended the holiday gathering at the center before leaving for unknown reasons, authorities said. He later returned with his wife. Both wore masks and tactical gear as they stormed the building toting assault weapons, officials said.

A dozen of the dead and 18 of the wounded were county employees, police said. About 75 to 80 people were in the room at the time of the attack.

Records show Farook was born in Illinois and lived in Southern California for at least the last nine years. He traveled to Saudi Arabia and Pakistan last year, returning with Malik, whom he met online, officials said.

The FBI said she was allowed to enter the United States on a K-1 visa, which is granted to people planning to marry in this country.