BLACKSBURG, Va. - A gunman killed a police officer in a Virginia Tech parking lot and was found dead nearby in an attack that sent fear through the campus nearly five years after it was the scene of the deadliest shooting rampage in modern U.S. history.

The school locked down Thursday for hours and warned students and faculty members via email and text message to stay indoors. The shootings came as university officials were in Washington appealing a fine that U.S. officials gave them over the school's response to the 2007 rampage, when 33 people were killed.

The campus swarmed with heavily armed police during the lockdown and manhunt. Students hid in buildings, a day before final exams were to begin Friday.

"Today, tragedy again struck Virginia Tech," said university president Charles Steger. "Our hearts are broken again."

Deriek W. Crouse, an Army veteran and married father of five, was killed after pulling a driver over in a school parking lot. Police said the gunman walked up, shot the officer and then fled on foot before he apparently killed himself nearby. The deceased suspect was not involved in the traffic stop.

State police said in a news release early Friday that ballistics tests confirmed Crouse and the deceased suspect had been shot by the same handgun. The tests have "officially linked the two fatal shootings," the release said.

Police said they don't know what motivated the officer's killing or whether there was any link between the shooter, who has not been identified, and Crouse.

Campus was quieter than usual Thursday because classes ended Wednesday. The school said exams that were to start Friday would be postponed.

The shooting came as Virginia Tech was appealing a $55,000 fine by the U.S. Education Department in connection with the university's response to the 2007 shootings.

The department said the school violated the law by waiting more than two hours after two students were shot to death in their dorm before sending an email warning. By then, student gunman Seung-Hui Cho was chaining shut the doors to a classroom building where he killed 30 more people and then himself.

The department said the email was too vague because it mentioned only a "shooting incident," not the deaths.

An administrative judge ended the hearing by asking each side to submit a brief by the end of January. It is unclear when he will rule.

Since the massacre, the school has overhauled its alert system and now sends text messages, emails, tweets and posts messages on its website. Other universities have put in place similar systems.

On Thursday, the school applied the lessons learned during the last tragedy, locking down the campus and using a high-tech alert system to warn students and faculty members to stay indoors. During about a one-hour period, the university issued four separate alerts

Derek O'Dell, a third-year student who was wounded in the 2007 shootings, was shaken. He was monitoring the situation from his home near campus.

"At first I was just hoping it was a false alarm," he said. "Then there were reports of two people dead, and the second person shot was in the parking lot where I usually park to go to school, so it was kind of surreal."