Officers spoke to the man for some time and the surrounding area was cordoned off to allow police to deal with the incident.
A North Yorkshire Police spokesperson said: "At around 11.20pm, the man, who is in his 20s, agreed to leave the scene with officers.
"Nobody was injured.
"He is currently in police custody and will receive the appropriate help and support."
The police helicopter was also called in as the incident unfolded.
Witnesses reportyed seeing armed police in the area.