Law enforcement officers assemble at a memorial service for fallen Massachusetts Institute of Technology campus officer Sean Collier at MIT in Cambridge, Mass., Wednesday.

CAMBRIDGE, Mass. — Slain Massachusetts Institute of Technology police officer Sean Collier was remembered Wednesday for his dedication to law enforcement and his love of people as thousands gathered at a campus memorial.

Vice President Joe Biden joined students, faculty and staff, and law enforcement officials from across the nation at Briggs Field for the service to honor an officer who was already well-respected by his colleagues and superiors, and popular with students after little more than a year on campus

Collier was fatally shot April 18, three days after the Boston Marathon bombings that killed three people. Authorities say he was shot by brothers Tamerlan and Dzhokhar Tsarnaev. Dzhokhar Tsarnaev was charged Monday in his hospital room, where he is in fair condition with a gunshot wound to the throat suffered during his attempted getaway. His brother, 26-year-old Tamerlan, died Friday after a gunbattle with police.

“My heart goes out to you,” Biden told Collier’s family. “I hope you find some solace in this time of extreme grief.”

He said he is constantly asked the question of why terrorists do what they do against the U.S.

“I’ve come to the conclusion they do it to instill fear,” Biden said. “To have us, in the name of our safety and security, jettison what we value most in the world, our open society, our system of justice that guarantees freedom. ... Our transparency; that’s their target.

“It infuriates them that we refuse to bend, refuse to change, refuse to bend to fear.”

Collier’s casket was positioned in front of the thousands who gathered on a bright, sunny spring day. Music of bagpipes echoed through the field and a large American flag, suspended high about the crowd between two fire department ladder trucks, flapped slowly in the breeze.

Boston native James Taylor sang “The Water is Wide” and led a sing-along during “Shower the People.”

Biden told the Colliers that no child should predecease their parents, and that better times are ahead.

“The moment will come ... when the memory of Sean is triggered and you know it’s going to be OK,” Biden said. “When the first instinct is to get a smile on your lips before a tear to your eye.”

Andrew Collier said his 26-year-old brother would have loved everything about the day, including the bagpipes and the American flag.

“He was born to be a police officer and lived out his dream,” Collier said.

MIT President L. Rafael Reif told those gathered that Collier made countless friends on campus.

“Sean Collier didn’t have a job at MIT, he had a life at MIT,” Reif said. “In just 15 months, he built a life with us. He touched people across our community.”

Campus Police Chief John DiFava acknowledged the risk that accompanied the position of police officer, but questioned whether the risk of a job in law enforcement needed to come with such devastation.

“Sean left a lot behind,” DiFava said. “He left us a lesson: Do it right!

“If you want to cherish his memory, remember to do it right,” he said.

State police said between 4,000 and 5,000 attended the service. The line of mourners stretched for about a half mile at MIT ahead of the service. They had to make their way through tight security, including metal detectors and bomb-sniffing dogs ahead of the service.

“He is the one of the nicest people that I’ve ever met,” said Kelly Daumit, 35, of Seattle, an engineering student at MIT who had gone on hikes with Collier as part of the MIT Outing Club. “Everything people are saying about him is completely genuine; it’s not because of what happened.”

MIT employee Larry Clark said he had only talked to Collier a couple of times but wanted to pay his respects.

“It’s very tough. It’s still a shock,” he said.

Bagpipers played “Amazing Grace” as Collier’s casket was carried from the service, and there was a fly-by with three helicopters over the campus.