McKay, 35, was in a firefight in the Big Bear area Tuesday with a man believed to be fugitive Chris Dorner. MacKay sustained multiple gunshot wounds and was transported to Loma Linda Hospital where he died of his injuries.
"My condolences go out to the MacKay family," said San Bernardino County Sheriff John McMahon during a press conference. "This is truly another sad day for law enforcement. Our department is grieving from this event. It's just a terrible deal for all of us."
Another deputy, Alexander Collins, was wounded at the cabin. He underwent surgery and will require several more, officials said.
MacKay grew up in the area and attended Rim of the World High School. His father was a captain in the San Bernardino County Fire Department.
MacKay leaves behind a wife, a 7-year-old daughter and a 4-month-old son.
MacKay spoke to The Associated Press on Saturday while he was helping patrol the Big Bear Lake area for Dorner.
As soon as he had heard news about Dorner's pickup truck in the area Thursday morning, MacKay headed out with his partner to help beef up patrol in Angelus Oaks - near the cabin where Dorner made his last stand. MacKay worked into the night and was back the next day at 7 a.m. to help again.
"It's probably one of the biggest tactical and logistics operations we've ever dealt with," MacKay said.
He said it was reminiscent of operations during the 2003 Old Fire, when a blaze in the San Bernardino mountains burned 91,000 acres and torched 1,000 buildings over nine days. But this was entirely different for one major reason.
"This one, you just never know if the guy's going to pop out or where he's going to pop out," MacKay said. "We're hoping this comes to a close without any more casualties. The best thing would be for him to give up."
Funeral plans for MacKay have yet to be announced.
The Associated Press contributed to this report.