A 20-year-old man in distress and carrying a sword surrendered on Saturday near Stockton, the San Joaquin County Sheriffs' Office said in a Facebook post.
Deputies said their office received reports around noon about a man standing in the roadway in the area of Wilson and E Streets holding a machete.
The caller said they were afraid for their safety and vacated the area, according to the sheriff's office.
After locating the man, deputies noted that the weapon was a three-to-four-foot sword and that the man appeared to be in an altered mental state but would not communicate with deputies.
The San Joaquin County Sheriff's Hostage Negotiations team was eventually able to talk to the man and were able to take him into custody after four hours without incident.
Deputies said the man was transported to a local facility to receive mental health treatment.