America's two largest school districts received similar threatening emails Tuesday but reacted in opposite ways: New York shrugged it off, while Los Angeles shut down its system.

The conflicting responses reflected starkly different atmospheres in the two cities.

In Southern California, authorities remain on edge following a Dec. 2 massacre in San Bernardino. Los Angeles Unified School District Superintendent Ramon Cortines invoked that attack in explaining his abrupt decision to order 640,000 students to stay home — a determination made over the objections of some authorities there, a senior law enforcement official in Los Angeles told NBC News.

The FBI found the threat to be "not credible," Los Angeles Mayor Eric Garcetti said. After officials swept more than 1,500 school facilities, "we believe that our schools are safe and we can reopen schools in Los Angeles Unified School District tomorrow morning," school board President Steve Zimmer said at a news conference late Tuesday afternoon.

Cortines, whose term as superintendent will end in a few days, defended his unprecedented move. "Based on past circumstances, I could not take the chance," he said.

Read more at NBC Los Angeles

In New York, home to more than 1 million public school students, Mayor Bill de Blasio and Police Commissioner William Bratton held a news conference of their own, saying the anonymous message seemed bogus and appeared to have been sent to other cities, as well.

The threat "was so generic, so outlandish and posed to numerous school systems simultaneously" that it was clearly not credible, de Blasio said. He added that it would have been a "disservice" to keep students home.

Bratton, a former chief in Los Angeles, suggested that officials there had overreacted. Seeming bemused, Bratton said the person behind the threat may have been a fan of the television show "Homeland."

But Garcetti and Los Angeles Police Chief Charlie Beck defended the decision there, stressing that because Los Angeles was the first city to receive the threat, Cortines didn't have all of the information that authorities in New York had.

"If you knew what [Cortines and law enforcement] knew at 5:30 this morning, would you send your children to school today?" Beck asked. The answer, he said, was "no."

Multiple law enforcement officials told NBC News that the emails were sent from an account named "madbomber" at a small domain predominantly hosting pornographic sites, and that they arrived at the school board Tuesday morning. According to a senior law enforcement official, the writer claimed to be a high school senior in Los Angeles who had been bullied and said he planned to attack schools with guns and bombs.

"It was not to one school, two schools or three schools," Cortines said. "It was many schools, not specifically identified."

Rep. Brad Sherman of California, a Democratic member of the House Foreign Affairs Committee, said in a statement that he had seen the Los Angeles message and that the writer also claimed to be a Muslim extremist who had teamed up with local jihadis. The writer didn't appear to understand Islam very well, however, Sherman said.

Garcetti said that while the threat turned out to be bogus, it inconvenienced more than a million residents and cost the city a huge amount of money.

"That's a serious crime, and somebody needs to pay for that," he said.

The email that reached New York was routed through the same IP address, law enforcement sources told NBC News. There were many similarities, but New York authorities, consulting with the FBI, concluded that it was likely a hoax, because the student was simultaneously claiming to be a student in both cities, the senior law enforcement official told NBC News. The misunderstanding of Islam also raised a flag.

Beck said subpoenas had already been issued, without elaborating.

Many parents in Los Angeles — and many officials — said they understood what Cortines did and expressed lingering fear from the attack on San Bernardino, where a radicalized husband and wife shot 14 people to death at a holiday office party.

The Los Angeles Unified School District operates more than 1,000 schools and employs nearly 60,000 people. Garcetti said students would be permitted to ride city buses and trains for free.

The threat itself — focused on the school district and no other institutions — is still being investigated and vetted, officials said.

The cancellation of classes was made early enough in the morning that many children had not yet left home or arrived at school. But Cortines said the district was making sure that administrators would help students return home.

Even so, the impact of the last-minute closing rippled through the city, as thousands of working parents were forced to attend to their children or find backup care.

Meanwhile, Cortines said, he ordered district plant managers to examine school grounds for "anything out of line."

The district will decide late Tuesday afternoon whether the schools are safe for students to return Wednesday, Cortines said.

Soon after the closing was announced, a 17-year-old student at Los Angeles International Charter High School was struck and killed by a city bus, authorities said.