The Machine would have seen this coming.

Outdoor filming of the CBS crime drama Person Of Interest was shut down on Wednesday after New York City police thought a scripted gun battle was the real thing.

The show centers on The Machine, a massive surveillance computer system that predicts crimes, but the prop guns used on the set caught some Big Apple residents by surprise.

Manhattan residents saw people with guns, assumed they were real, and called the New York Police Department who dispatched officers to the scene, according to a report in TMZ on Wednesday.

Gun scenes on the show were supposed to be filmed with NYPD supervisors on the set and since none were present, the outdoor filming was shut down.

The mayor's office confirmed the show's permit was revoked, which forced producers to stop filming.

Production company sources told TMZ the incident occurred due to a scheduling error that moved filming up before NYPD monitors arrived.

The incident did not impact the filming of indoor scenes that continued without interruption.

Person of Interest stars Jim Caviezel as former CIA officer John Reese and Michael Emerson as reclusive billionaire software genius Harold Finch, who built The Machine after the Sept. 11, 2001 terrorist attacks to prevent future attacks.

The show was based on a screenplay developed by British-American film writer Jonathan Nolan, who co-wrote 2008's The Dark Knight with his brother Christopher.

J.J. Abrams is a producer of the series that made its debut in September 2011.

The show will have its season three premiere next week in its new 10pm time slot on Tuesday nights.