On the last day of his nine-year life, Piper the border collie chased a snowy owl from the runway at the airport in Traverse City, Michigan. It was the 8,367th bird he had scared off in a three-year career as the airport’s K-9 wildlife control officer – which turned him into one of the nation’s most famous dogs.

Piper began his duties in late 2014 as the sidekick to his owner, airport operations manager Brian Edwards. The dog went viral a little more than a year later, when images of him – looking “Top Gun” chic in protective goggles – hit the social site Reddit. On Wednesday, he lost a year-long battle with prostate cancer, an illness Edwards did not reveal publicly until Piper’s death.

In an interview, Edwards said he kept his pet’s health troubles to himself partially out of a desire for privacy after a “crazy year,” but also because the pooch – who used his herding skills to clear the airfield of mammals like foxes and groundhogs, too – kept going until the end. The cancer was diagnosed in January 2016, but Edwards said Piper didn’t show symptoms until December. Even so, the duo worked a regular 10-hour shift on Christmas.

“I think we were lucky to get a year out of him,” Edwards said. “It’s cancer. It’s life. You can’t predict anything.”

Like many internet-famous animals, Piper had slick social media accounts and a website, which Edwards said he initially established because he figured some other dog and aviation enthusiasts might appreciate them. But Piper found a far wider audience because he was a simply perfect character: Here was a dog with markings and tactical gear that made him exceedingly photogenic, with smarts and drive that kept people safe, and with a love for his master and his work that were abundantly evident.

“We literally did spend almost every second together” once Piper began the job, said Edwards, who’d adopted the dog when he was 2. “For me, it was almost more special that we morphed from being dad and son to working partners.”

Piper was the subject of news stories around the world. T-shirts and hoodies with his image were made. A photo of him won a U.S. Coast Guard-sponsored contest.

Despite his fame, he continued to log 40 hours each week of work that Edwards described as “a dream job for a dog.” Collisions with birds and other wildlife can be extremely dangerous to aircraft and the people on board, and the Federal Aviation Administration requires airports to have plans to mitigate that hazard. Cherry Capital Airport was already using pyrotechnics and other means to keep animals away from planes when Edwards began studying up on the use of dogs – a tool that’s rarely employed but that can be very effective.

“I said, ‘Well, what can the dog do for us?’” airport manager Kevin Klein told the Traverse City Record-Eagle in 2016. “And Brian showed us (Piper’s) skills and I thought that Piper had lots of talent.”

Edwards started Piper out with obedience and off-leash training at home. That led to some time hanging outside the airport and getting used to the loud noises. In a Reddit question-and-answer forum, Edwards said Piper took about a year and a half of “passive training” – plus three days or so of acclimation to the goggles – to be ready for his chasing and patrolling duties.

Eventually, Piper felt right at home on the runway, as the GIF that made him an online sensation made clear.

“And my dog gets scared by the vacuum,” one Reddit commenter quipped.

As his tumor swelled in recent weeks, Piper began having trouble urinating, Edwards said. “Things were fine until New Year’s Eve, and then the tumor had grown too large, and he just couldn’t go anymore,” Edwards said, choking up.

On Tuesday, his veterinarian drained the dog’s bladder with a catheter and said it might make him comfortable for a few days. It didn’t last, though, and Edwards said he and the dog left their shift on Wednesday morning to have it drained again. They returned to the airport that afternoon so that Piper could “say goodbye to all his fellow co-workers.”

Piper died in his arms that night, at the house “we purchased together,” Edwards said. He draped a U.S. flag – flown that day at the Coast Guard air station at the airport – over the dog’s body, shared a photo on Instagram and asked for “patience as I take time to tend to my shattered heart.”

In addition to all those chased birds, Piper had patrolled 1,907 miles and worked 6,206 hours at the airport, according to his website – which, as of Friday, still made no mention of his death.

In the upper right-hand corner was this status: “Airport K-9 Piper is off-duty.”

Follow the Bangor Daily News on Facebook for the latest Maine news.