In his first class, 13 of the some 220 students had been shot  two of them twice. “They don’t graduate,” he said. “It’s tough.” He taught for seven grueling and rewarding years that showed him the flip side of his life as a cop, “being with kids and seeing the problem from a different perspective,” he said, “trying to understand the drug culture, the impact of the drug culture and our responsibility for creating this culture.”

Image The television writer Ed Burns in his West Virginia home. The irony is that you have to be somebody before anybody listens to you, he said of the attention The Wire brought to urban issues. Credit... Will Hart/HBO

But then Mr. Simon swooped in again, this time with the idea for “The Wire,” and Mr. Burns left teaching to sign on as a story editor. (“For somebody who never made money, it was like, ‘Whoa, I can have a few dollars,’ ” he said about getting his first paycheck for the series.)

“How did he learn it?” Mr. Simon recalled. “I gave him a bunch of scripts. ‘Homicide’ scripts, ‘Corner’ scripts, showed him the dynamic. One thing about Ed is you don’t have to show him anything twice. This is a guy who devours any idea he encounters.”

For Mr. Burns, who believes most Americans think starting a wiretap is as simple as one guy in a cop show saying as much to another, “The Wire” was an opportunity to “get it right,” he said. He conceived the morbid arc for the fourth season, in which killers working under the drug dealer Marlo Stanfield dump bodies in boarded-up row houses. “Police work has come to be about numbers,” he said. “This was a twist on it. This was Marlo doing his part. ‘If I don’t have murders, then they won’t come.’ ”

Mr. Burns also came up with a mystifying split second in a third-season episode: a shot of William A. Rawls (John Doman), a hard-line deputy commissioner, during a scene that takes place in a gay bar. The moment was never revisited or explained. “It would have been a nice twist to have Daniels, who is in line to be commissioner, have him discover Rawls’s fatal flaw and choose to ignore it,” he said. “And have Rawls cut him down. We laid the mine. We just never stepped on it.”

And yet for all the praise “The Wire” garnered, Mr. Simon said, Mr. Burns finished every season “absolutely frustrated and convinced we had ruined the show.” But then he would come around. “He would put the tape in, in the end, and I’d hear from him a month afterward. ‘No, actually, that was really good in the end.’ ”