Taylor Swift’s NYC townhouse got an unwanted visitor Saturday … and police arrested him on an unrelated warrant, TMZ has learned.

taylor swift stalker
Getty/Backgrid Composite

Law enforcement sources tell us … cops received a 911 call in the afternoon for a “disorderly person” and responded to Taylor’s fancy Manhattan neighborhood, where the pop superstar owns some pricey real estate.

taylor swift stalker
Backgrid

When they arrived, the officers encountered the unruly man and soon learned he tried but failed to access Taylor’s building, our sources say.

taylor swift stalker
Backgrid

Whether he knew it was Taylor’s crib or not is anybody’s guess, but we’ve obtained photos of the guy standing right outside the front door of her building. Creepy!!!

Other images show NYPD cops cuffing the dude and shoving him into the back of a police cruiser.

taylor swift stalker
Backgrid

We’re told police ran a background check on the unnamed suspect and arrested him on a 2017 warrant for failing to answer a court summons in Brooklyn.

It was unclear what the warrant was for.

NYPD officials have not indicated whether they will recommend charges for this latest incident.

We’ve reached out to Taylor’s team … so far no word back.

TS’ got more than enough reason to be nervous about people showing up at her place … she’s got a long, documented history with stalkers — one was arrested less than two years ago for trying to get into her Manhattan home.