This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

DEVORE, Calif. (KTLA) — Thousands attended an emotional final farewell on Thursday for San Bernardino sheriff’s Detective Jeremiah MacKay.

MacKay, 35, was killed in a gun battle with rogue former LAPD officer Christopher Dorner last week in Big Bear.

The motorcade from the mortuary in San Bernardino to the San Manuel Amphitheater in Devore stretched for miles.

Thousands of cops and civilians from three states came to pay their respects to MacKay, who was a 14-year veteran of the sheriff’s department.

It was a ceremony fit for a hero, with an honor guard, a riderless horse, a massive helicopter flyover and, of course, MacKay’s beloved bagpipes.

Co-workers said it was fitting that MacKay had spent the day before he died with his wife, Lynette, his daughter, 6-year-old Kaitlyn, and his 4-month-old son, Cayden.

“Lynette expressed her gratitude that her children were able to spend Monday with Jeremiah, because Tuesday he did not come home,” said San Bernardino Sheriff John McMahon.

For days before that respite, MacKay had been patrolling in the mountains where he had grown up, searching for the fugitive Christopher Dorner.

MacKay had volunteered for the task, McMahon said, adding that he had approached the manhunt with “courage, tenacity and resolve.”

McMahon said MacKay was at a “tremendous disadvantage” during the gunfight, but that he “remained because it was his duty … to place his life at risk to stop an evil man.”

Close friend and fellow deputy Roger Loftis spoke about MacKay’s desire to find and confront Dorner during his murderous crime spree against cops and their families.

“Jeremiah told me sometime back that he was going to catch that guy. Last time I talked to him, he told me that. And he did,” Loftis said.

MacKay graduated from sheriff’s trainee to deputy sheriff on his 21st birthday. He later was promoted to detective, and was most recently stationed in Yucaipa.

MacKay was remembered as a “cop’s cop” with an infectious sense of humor.

Colleagues said he won the office ugly Christmas sweater contest and carried a pink Hello Kitty lunch bag. He was said to have the distinctive “laugh of someone who truly enjoyed life.”

Three times, speakers referred to the Bible verse John 15:13: “Greater love has no man than this, that a man lay down his life for his friends.”

McMahon said that MacKay “truly died so that others did not have to.”

His father, Alan MacKay, described his son as a protector who “wanted to intervene when somebody was hurting somebody else.”

“I think the reason Jeremiah was taken home… was that heaven needed a training officer,” he said.

“I trust in the Lord, because I know that I will see my son again,” he reflected. “See you later, Jeremiah.”