There were many strands to Dr. Khan’s energetic life that the Taliban would have found objectionable. In the past year, Dr. Khan, 56, who was trained as a psychiatrist in Vienna, taught what he called a “worldly” Islam to 150 young boys who had been corralled by the Taliban and then freed by the Pakistani Army in the Swat Valley. “He said: ‘This is my passion,’ ” his wife, Dr. Rizwana Farooq, a gynecologist, recalled of her husband’s weekly sessions at a vocational school, called New Dawn. The school was established by the Pakistani military with financing from international aid organizations.

In recent years, Dr. Khan grew intrigued by American democracy. He visited the United States as a guest of the government in 2002, he met Secretary of State Hillary Rodham Clinton on her first visit to Pakistan last year, and he was among those chosen to attend a farewell lunch for the departing United States ambassador, Anne W. Patterson, last month. “Dr. Khan has been a longstanding and valuable contact, a strong and central voice in denouncing extremism,” said Elizabeth Rood, the consul general in Peshawar.

But perhaps most challenging to the Taliban was his position as the vice chancellor of a new, liberal university in Swat, whose inauguration was scheduled a few days after Dr. Khan was killed. The Taliban effectively governed Swat, an area of scenic beauty within easy drive of the nation’s capital, for several months in 2009 before being driven out in a major military offensive.

The university had been a sore point with the Taliban for some time, partly because the government originally decided the campus would be built on land where the Taliban ran their biggest mosque and school. That site was later abandoned for a more neutral location on the edge of Mingora, the capital of Swat, and over the last year Dr. Khan had taken charge of hiring the faculty, shaping a curriculum devoted to the social sciences and recruiting a student body, said the rector of the university, Sher Alam Khan.

Of 280 students selected on merit, 50 were women, Mr. Khan said. Three of the 20 faculty members were women, he added.

The father of four children ages 22 to 27, all of whom are professionals, Dr. Khan may have been particularly irritating to the Taliban because his roots were in the rough and tumble of the nation’s right-wing religious parties, not the elite academies and mainstream parties.