A Chester County deputy sheriff shot and killed a knife-wielding Coatesville man inside the county courthouse Tuesday after the man barreled into the building and slashed another officer.

The attack and shooting occurred around noon, sending the bustling Justice Center, in the heart of West Chester, into lockdown.

By late Tuesday, investigators were still trying to determine a motive for the attack. They noted that the man, Curtis W. Smith, had domestic problems and in March had been arrested after scaling a wall at the White House.

But it wasn't clear if that or something else stirred him. Smith, 34, had been told the misdemeanor case against him in Washington would be dismissed this fall if he avoided further incidents. He had no apparent criminal record or history of mental distress.

Residents on the Coatesville street where he had lived since 2011 described him as a devoted father and a man who walked their dogs, mowed their lawns, and played outside with their children. One called him "the dad of the neighborhood."

Chester County District Attorney Thomas Hogan said his office planned to say more about the case Wednesday. He noted the White House incident and that Smith had been under a protection-from-abuse order. But, Hogan said, "the only one who really knew his motive was him."

At a brief news conference earlier in the day, the prosecutor did not name the officer who pulled his weapon and shot Smith in the midsection. He said he would wait until after the investigation ends to comment on the sheriff's use of force.

Smith died at Paoli Hospital.

Kevin Brough, the 22-year-old deputy slashed in a hand and arm who had worked for the sheriff's office for a year and a half, was flown to a trauma unit. He was listed in stable condition and was scheduled for surgery Tuesday evening at the Hospital of the University of Pennsylvania, Chester County Sheriff Carolyn Bunny Welsh said.

The shooting sent shock waves through the courthouse, which houses judges' chambers, courtrooms, the offices of the county clerks and the district attorney, and other agencies. Several hundred people walk through its doors each day. On Tuesday, two jury trials were in session.

Sarah Finnaren of West Chester was visiting her former coworkers in the Justice Center when she thought she heard breaking glass.

Employees recognized the sound as gunshots and locked the doors.

Finnaren watched police and emergency medical services personnel arrive. "I'm still trying to calm down," she said a few hours after the shooting.

The building stayed closed for the day.

Until this past winter, Smith had appeared to avoid the limelight. A Facebook page that matched Smith's profile said he had attended Coatesville High School. He had started working as a truck driver for AmeriGas in late January, a company spokeswoman confirmed.

But on the first Sunday in March, Smith drove from Pennsylvania to Washington, scaled a stone wall at the White House, and began walking across the grounds.

After his arrest by the Secret Service, Smith told agents and his court-appointed lawyer he wanted to deliver a message to President Obama. He didn't specify what the message was.

The Maryland-based lawyer, Martin Rosendorf, said he had handled several cases of people trying to access the White House. Usually, Rosendorf said, the suspects are "kind of wild-eyed and start ranting," but Smith did not fit that description.

"If I thought there was some real mental health problems, I would have asked for an evaluation," the lawyer said. "What he did was kind of strange, but he spoke normally. He didn't seem like he was angry."

The two judges who presided in the case also didn't press the issue, according to Rosendorf. Prosecutors ultimately agreed to defer the prosecution, which meant Smith had only to avoid further incidents and the charges would have been dismissed this fall, the lawyer said.

Smith stopped working for AmeriGas in April, a company spokeswoman said. It was unclear why he quit or whether he found other work.

Smith had married nearly a decade ago, public records show, and bought his house along Community Lane in 2011 from Community Youth and Women's Alliance, a social service agency that helps people get affordable housing.

Neighbors said he had two young boys and was a mentor at times to other boys. Some reeled from the news.

"When I was pregnant and by myself, he was always shoveling my car," said Jen Spadaro, who lives across the street. "He will be missed around here. He took care of everyone."

Inquirer staff writer Jonathan Tamari contributed to this article.