A man armed with what appeared to be a semi-automatic rifle surrendered after an hours-long standoff in North Hollywood that followed a high-speed pursuit on Southern California freeways.

The man directed his rifle at officers during a high-speed pursuit from east of downtown Los Angeles to the San Fernando Valley, pulled over, ran through a neighborhood and climbed onto the roof of a house. He barricaded himself inside the house until 3 p.m.

The homeowner, Cynthia Duvall, said she was watching the news on TV when she realized that the gunman was holed up in her house.

"It was random," she said. "I thank God none of us were home. I mean, thank God. Everything else is materialistic."

Breaking News Alerts: Download the NBCLA News App

The suspect, identified as 41-year-old Nolan Perez, came outside of the North Hollywood house with two dogs and lay down on the ground before SWAT officers took him into custody in the backyard, according to Los Angeles police. He was then taken out of the patrol car and trasnferred into an ambulance.

He was believed to be the only person in the house during the standoff.

Perez was wanted in connection with a criminal threats report filed on Monday, officials said. He was located Monday morning in El Sereno and fled after encountering officers, police said.

Authorities told the NBC4 I-Team that the chase began at the home of Perez's ex-girlfriend. He was there because their relationship had failed.

The manhunt and standoff forced hours-long lockdowns at nine schools and evacuations near the barricade location in the 11600 block of Hartsook Street, just blocks from the Los Angeles Police Department's North Hollywood Station.

"We're going to make every attempt we can to make contact with this suspect. We don't want anybody to get hurt here, including the suspect," LAPD Lt. Andy Neiman said.

The standoff began after a pursuit that reached speeds around 100 mph on several freeways near downtown LA before extending north into the San Fernando Valley. The driver of the Nissan sedan encountered traffic on the northbound 5 Freeway and used the emergency lane next to the center divider to pass several vehicles.

At one point, Perez appeared to wave the rifle out a window before exiting the freeway in North Hollywood and stopping on a street near Magnolia Boulevard and Irvine Avenue.

Dressed all in white, he could be seen carrying the weapon and what appeared to be a clip of ammunition when he sprinted from the car and across several residential yards, then climbed onto the roof of a house. He leaned against the weapon, paced around and kneeled down on the roof before jumping off into a back yard about 15 minutes later.

"It was a little bizarre, how calm he was," a resident said.

There were no reports of shots fired in the residential area just west of the 170 Freeway, where an LAPD helicopter circled overhead.

The homeowner said she believes the suspect entered the house through a rear door that was left unlocked by her ex-husband, who was in the backyard at the time.

By late Monday night, investigators had not allowed her back into the home.

Earlier, authorities blocked off an area that includes Magnolia Boulevard to the north, Otsego Street to the south, Tujunga Avenue to the east and Colfax Avenue to the west.

Oakwood School, Joyces Toluca Lake Preschool, Walter Reed Middle School, North Hollywood High School and Colfax Charter Elementary School were among the schools locked down during the search. Police established an evacuation plan so parents could pick students up from Oakwood School, which is adjacent to the street on which authorities said the subject is barricaded.

"It was very reassuring to know she was all right," said parent Robin Share, who was texting with her daughter at Oakwood School during the lockdown. "She was in the middle of a final exam and wanted to finish. She's determined."

Aerial video showed children walking hand-in-hand as they were escorted to nearby North Hollywood Park to be reunited with parents. All LAUSD school lockdowns were lifted early Monday afternoon.

The southbound lanes of the 5 Freeway were shut down at the 170 Freeway as police searched for evidence after the standoff.