A man armed with two large kitchen knives led Seattle police on a lengthy chase in the University District on Thursday afternoon before surrendering. He was uninjured after being shot at, stunned with a Taser and targeted by SWAT officers firing rubber bullets, according to a department spokesman.

The man, who appeared to be in his 30s, dropped both knives at different points during the pursuit, which stretched for roughly 15 blocks, ending in an alley near the corner of Northeast 41st Street and Eastlake Avenue East in the University District, said department spokesman Patrick Michaud.

The man, who had taken cover behind some garbage cans, eventually gave himself up and was to be booked into the King County Jail on investigation of felony harassment, said Michaud. Officers trained in crisis intervention spoke to the man at various points during the chase and persuaded him to surrender, he said.

Shortly before 5 p.m., patrons inside Cafe Racer — the scene of a deadly shooting spree in May 2012 — called 911 to a report a man armed with knives in front of the business at 5828 Roosevelt Way N.E., according to Michaud.

“He was out in front of Cafe Racer, waving two, large knives around. It spooked people inside enough that they called 911,” he said.

Officers responded, and the man jumped a fence near the cafe, dropping “a large, 9-inch kitchen knife,” Michaud said.

Officers lost sight of the man but then confronted him in the courtyard of an apartment building in the 4200 block of Roosevelt Way N.E., he said. He approached a group of officers with a knife, and a University of Washington police officer fired a Taser at the man, who then cut the wires leading to the darts with the knife, Michaud said.

When he approached officers a second time, one Seattle police officer fired a single gunshot before the man jumped another fence, dropping the second knife, he said.

SWAT officers cornered him nearby between a wooden fence and a concrete wall, where he hid behind garbage cans to avoid being struck by rubber bullets, said Michaud, adding that it’s unclear if any of the projectiles hit the man.

The Crisis Intervention Team officer who fired his duty weapon was placed on paid administrative leave while the shooting is investigated, he said.

Julian Hannush, a University of Washington student who lives at the College Place Apartments on Eastlake, heard yelling and gunshots and witnessed part of the incident from his sixth-floor window. He heard officers yell for the man to drop the knife and said one officer said, “I don’t want to shoot you.”

“I saw one officer take one shot at him,” Hannush, 20, said.

Hannush also received a text alert from the university, saying “there was a man with a butcher knife running around.”

“It definitely shakes up your day. I’m glad to see nobody was killed,” he said.

Seattle Times staff reporter Steve Miletich contributed to this story.Sara Jean Green: 206-515-5654 or sgreen@seattletimes.com