New York City law enforcement authorities are on high alert after receiving a warning by the feds about a possible attack by al Qaeda on the eve of Election Day, sources said.

US intelligence officials alerted joint terrorism task forces of the threat, which also included Texas and Virginia — though specific sites targeted for Monday in the three states were not mentioned, a federal source told The Post.

Mayor Bill de Blasio said Friday he had learned of the threat several days ago during classified briefings.

“We are still very much assessing the credibility. It is not at all clear how credible this is,” de Blasio told WNYC’s Brian Lehrer on his weekly radio show. “We’re certainly in a vigilant position.”

Hizzoner said the NYPD is planning an “extraordinary” police presence for Tuesday, when Americans go to the polls.

“For the first time in memory there will be two presidential campaigns having their victory celebrations in New York City on Tuesday night,” he said, quickly correcting himself that only one candidate will be celebrating.

Donald Trump, the Republican nominee, will be at the New York Hilton Midtown on Sixth Avenue, while Hillary Clinton, his Democratic counterpart, will be at the Javits Convention Center across town on 11th Avenue.

Police also will be heavily deployed for the New York City Marathon on Sunday, de Blasio said.

Meanwhile, Gov. Andrew Cuomo declined to confirm the threat Friday but also noted the high state of alert for Election Day.

“We have more state police, more National Guard, more soldiers on duty than ever before,” he said. “So the bad news is New York is often a threat. The good news is we’ve been dealing with this now for over a decade and we have prepared for it.”

The NYPD and the Port Authority of New York and New Jersey said they had been alerted to the possible attacks.

“We are aware of the information. We have been working with the FBI through the Joint Terrorism Task Force and our Counterterrorism and Intelligence Bureaus,” the NYPD said in a statement.

“We continue to encourage anyone with any information that could be relevant to the safety of our city to contact law enforcement,” the department said.

The Port Authority — which operates airports, tunnels and bridges in and around the Big Apple — said it too was prepared.

“We are continuing the high level of security we have had in place at all of our facilities for many months,” spokesman Steve Coleman told The Post.

The FBI did not comment specifically about the threat against the three states, but said counterterrorism and Homeland Security authorities “remain vigilant and well-postured” to handle attacks.

“The FBI, working with our federal, state and local counterparts, shares and assesses intelligence on a daily basis and will continue to work closely with law enforcement and intelligence community partners to identify and disrupt any potential threat to public safety,” an FBI official said.

Friday’s threat followed a report by NBC News that the US government believes hackers from Russia or other countries may try to unleash cyberattacks to wreak havoc ahead of Election Day.

An effort coordinated by the White House and the Department of Homeland Security — and including the CIA, the National Security Agency and other elements of the Department of Defense — is being conducted to avert attacks, NBC News reported.

Rich Calder and Kirstan Conley contributed reporting