Bogart Salzberg was just 36 when doctors diagnosed him with terminal brain cancer in 2011. With death looming, the Portland man, whose varied past included stints as a woodworker and newspaper journalist, resolved to chart age 40 “as the outer edge” of his remaining life.

Salzberg died Jan. 6, at that very age. But he fought to defy the odds, living longer than most patients diagnosed with his rare form of cancer and facing death head on, publishing chronicles of his search for meaning while paddling Maine waters as his disease progressed.

“I’ve done everything I could wish for,” Salzberg said in an interview last fall, struggling to speak and move as his brain cancer advanced.

“I’m not bitter about it or angry about it,” he said. “I’m thankful for it if anything. I wish I could have gotten a few more years … but I feel like I truly lived.”

His loved ones gathered to celebrate and remember his life Wednesday on East End Beach in Portland.

His friend Suzanne Blackburn saw Salzberg as “a living example of what dying can be.”

“I want my dying to be a conscious experience,” she said in October. “We don’t talk about it. We don’t deal with it. We put people away and medicate them. I think we ought to go into it with curiosity.”

Salzberg, who grew up in Limerick, was working as a self-taught software developer and raising a son with his wife in Portland when he started suffering bouts of nausea and headaches. In May 2011, he visited a hospital emergency department, where a scan revealed gliosarcoma, a deadly brain cancer with a five-year survival rate of only about 20 percent for adults under 40.

He was just four years away from that age at the time.

Multiple rounds of chemotherapy, radiation and surgery followed. The cancer ended Salzberg’s nascent career as a software developer, coincided with a divorce and stirred old pains in his relationship with his mom. But it also led him to find refuge in the form of another career as a kayaking guide along Maine’s coast and rekindled his creative roots in writing.

He wrote about his life after the diagnosis on a blog, My Brain Cancer Diary. It featured a “survival index” that counted the number of days he continued to live after doctors found the egg-sized tumor inside his brain. He also penned a three-part series for the Working Waterfront, documenting a “farewell voyage” windsurfing from Portland to Bar Harbor.

Salzberg had discovered a joy in the open water at the end of the summer of 2011. Recovering from brain surgery and chemotherapy, he went swimming at a friend’s camp on Damariscotta Lake and returned to shore a different man.

“I wanted only to be in the water or on the water, never mind the cost,” he wrote. “My death would come in a year, statistically speaking, so why not enjoy what life I have? I bought a wetsuit, a kayak and a sailboard, and hurried to deplete myself in pursuit of the moment.”

In 2012, Salzberg “began to prepare for the summer that was forecast to be my last,” gravitating towards the water, going sailboarding and kayaking in Casco Bay — while dreaming of longer adventures.

Being out on the water, as risky as it could be, became a way to get exercise and escape the sadness brought on by his illness, as well as the everyday pains of life.

“Sometimes I believe, superstitiously, with self-disgust, that I deserved my cancer; that I wanted it,” Salzberg wrote in March 2013. “Sometimes I believe that I wanted to relieve myself of adult responsibilities, as much as to relieve my pain; that I wanted a second chance to see the world with a child’s eyes.”

In August 2012, Salzberg embarked on his journey of a lifetime, windsurfing from Portland to South Bristol in the first leg. The next month, he kayaked from Pemaquid Harbor to Bar Harbor — the home of his alma mater, College of the Atlantic, and a place that reminded him of “happier times.”

Brushing aside warnings of “high winds and seas,” Salzberg set out on the last leg of that trip from Stonington, bound for Bar Harbor by the end of the night. Paddling around Mount Desert Island in the dark, he hit swelling waves and was twice thrown from his kayak. He bailed and tried to climb to safety with his kayak over the steep, barnacle-covered cliffs.

“It was then that I realized that for all the depression I had been suffering, all the thoughts of death, that I really did want to live, even if that did mean dying of brain cancer,” Salzberg said in an interview for WMPG. “I tried again and found a handhold and a foothold and pulled myself out of the water, without the kayak.”

He recovered the kayak the next day, and he used it the next two summers as a registered Maine guide, leading trips around Casco Bay for Portland Paddle and Maine Island Kayak Company.

“He was one of the most agile and fearless boaters I’ve ever known, capable of leaning to the side and resting while keeping his kayak upright,” Blackburn, a Portland Paddle guide, said. “When we teach balancing, we now call it ‘Bogarting.’”

Blackburn said she found Salzberg’s pursuit of kayaking and his bucket list trip motivational.

“I view it from lots of different angles, from a kayak guide and a mom,” she said. “He took some risks that weren’t really prudent. The adventure side of me really understood why he did.”

Blackburn went on a number of a trips in Casco Bay with Salzberg and later offered him conversation and massages after his mobility declined. He was stricken by debilitating seizures, eventually losing the use of his right hand and struggling to speak.

In an April 18, 2015, entry in My Brain Cancer Diary, he wrote of his efforts to “be the light” by connecting with others despite the ongoing seizures.

“I addressed people on the street with a hearty but dewy ‘good afternoon’ as I shuffled down the street with a cane,” he wrote. “The basis of this practice (which, again, is contrary to a prevailing Yankee restraint) was the idea that by demonstrating courage in lowliness I would lift people’s hearts and remind them of how much they care for each other, in general. I styled myself the antidote to selfishness.”

Blackburn has worked with Maine Adaptive Sports and Recreation to give people with physical disabilities a chance to experience the water through kayaking — something Salzberg said he would recommend to others with advanced illnesses, if not the extended trip he took.

Zack Anchors, the owner of Portland Paddle, hired Salzberg as the kayaking and paddleboarding outfitter’s first guide.

“I got the impression that being on the water, even if it was just floating in a kayak rather than paddling, was very therapeutic and calming for Bogart,” Anchors said in an email. “And I think that’s something that is true for lots of people, including people who are struggling with serious illnesses and other life struggles. It’s amazing how crossing the threshold from land to water can transform people’s mental state and really transport them out of their everyday world.”

In October 2014, not long after learning his cancer was again growing and that he was due for more treatments, Salzberg looked back on his bucket list trip with content.

“I wanted it to be something that would give me a lot of memories, also something that would give me a lot of confidence, and maybe if I saw how dangerous it was and how close I came to dying, I might appreciate life more. I think that’s what it did.”

On his blog, the survival index has ceased its count. Salzberg lived for 1,707 days after his diagnosis, it reports.

“If I had the choice of whether I would take the years of life left of a typical life and compare that to the few years of adventure and nature and appreciation for nature [I had], I don’t know which one I would choose to be honest with you,” he said.

BDN Enterprise Editor Jackie Farwell contributed to this report.