On a cool autumn morning 45 years ago, Dianne Feinstein was the first to find the body.

It was November 1978, and San Francisco Supervisor Harvey Milk had just been shot dead in his City Hall office.

“I could smell the gunpowder. Harvey was on his stomach,” Feinstein told The Times in an interview in 2018. “I tried to find a pulse; I put my finger in a bullet hole.”

The assassination forever altered the course of Feinstein’s political career and shaped her views on gun control — a defining legacy for the U.S. senator, who died Friday at age 90.

A few hours after finding Milk’s body, Feinstein broke the news that embittered former Supervisor Dan White had killed Milk, one of the nation’s first openly gay elected officials, and Mayor George Moscone.

“As president of the Board of Supervisors, it is my duty to make this announcement: Both Mayor Moscone and Supervisor Harvey Milk have been shot — and killed,” Feinstein said at a press conference, drawing gasps and shouts from the scrum on a balcony at City Hall. After several seconds, she continued: “The suspect is Supervisor Dan White.”

From there, the news of the assassinations shocked the country.

Earlier that morning, Feinstein had told reporters she was quitting politics after two unsuccessful runs for mayor. But as acting mayor, she was chosen to serve the remainder of Moscone’s term and would go on to win two mayoral elections.

“I became mayor as the product of assassination,” Feinstein said in the 2018 Times interview.

For a time, she had a permit to carry a handgun in her purse after an anticapitalist terrorist group planted a bomb outside her daughter’s bedroom window and shot out windows at her vacation home years before Milk’s assassination.

“I made the determination that if somebody was going to try to take me out, I was going to take them with me,” Feinstein told the Associated Press.

But she stopped carrying the gun after wondering how quickly she could arm herself in an emergency. “I thought, ‘Hmm. This isn’t going to do me much good,’” she said.

By 1982, she had signed a local ordinance banning most San Francisco residents from owning pistols and turned in her .38-caliber Smith & Wesson revolver — the same model White used to kill Moscone and Milk — to be melted down by police. The ordinance was later invalidated by the courts.

As her star rose, despite a failed bid for California governor, Feinstein set her sights on the U.S. Senate.

Just months after winning office in a 1992 special election, Feinstein wrote a landmark federal assault weapons ban, prompted by a mass shooting that left eight people dead at a San Francisco law firm.

The powerful National Rifle Assn. mounted an attack against Feinstein’s effort, joined by elected Republicans.

“The gentlelady from California needs to become a little more familiar with firearms,” Sen. Larry Craig (R-Idaho) said on the Senate floor.

Feinstein locked eyes on Craig and recounted the morning when she had rushed to Milk’s office after hearing gunshots, finding his bloodied body on the floor.

“Senator,” she said, “I know something about what firearms can do.”

Ten years after President Clinton signed the assault weapons ban in 1994, the landmark legislation expired, never to be renewed.

But the killings of Moscone and Milk stayed with her throughout her political career and “helped form who I am and what I believe,” she told the San Francisco Chronicle in a story on the 30th anniversary of the assassinations.

Mass shootings have been a staple of American life in the decades since, and with each successive horror, Feinstein renewed her calls for stricter gun control.

In a 2013 argument on the Senate floor with Sen. Ted Cruz (R-Texas), as Feinstein pushed for a new federal ban on assault weapons, she connected recent tragedies to her experience in 1978.

“I walked in, I saw people shot. I’ve looked at bodies that have been shot with these weapons,” she said. “I’ve seen the bullets that implode. In Sandy Hook, youngsters were dismembered.”

After shootings that killed a combined 31 people last year in Buffalo, N.Y., and Uvalde, Texas, Feinstein asked on the Senate floor: “What will it take for us to hear the wake-up call and pass stronger gun legislation?”

The Senate’s failure to act, she said, was all but guaranteed after inaction followed countless mass shootings, including massacres at Sandy Hook Elementary School in Connecticut and Marjory Stoneman Douglas High School in Florida that had drawn furious pleas from Feinstein.

“And make no mistake about it, it will cost lives,” she said.

In eulogizing her Friday, colleagues remembered her tenacity.

“We were not only colleagues, but neighbors and friends,” Rep. Nancy Pelosi (D-San Francisco) said in a statement, calling the now-lapsed federal assault weapons ban an “essential template for ending gun violence.”

Rep. Katie Porter (D-Irvine), who is running for Feinstein’s seat in 2024, posted on social media that “Feinstein was a trailblazer for women in California politics, and her leadership on gun violence prevention and anti-torture made our nation more just.”

Gov. Gavin Newsom, who signed several bills this week advancing California’s efforts on tightening its firearms laws, called Feinstein “an early voice for gun control.”

“Every race she won, she made history, but her story wasn’t just about being the first woman in a particular political office, it was what she did for California, and for America, with that power once she earned it,” Newsom said in a statement on social media. “That’s what she should be remembered for.”

Times staff writer Seema Mehta contributed to this report.