Just over a century and a half ago, New Hampshire resident Sylvester Marsh approached his state legislature for permission to build his dream: a steam engine that climbed to the peak of Mount Washington. Local lore has it that he was met with ridicule, but his request was granted, as he was investing $5,000 of his own money and raising more.

Marsh’s plan was far from a bust. This summer, the Mount Washington Cog Railway, known as “The Cog,” celebrates 150 years of operation, during which it has brought tourists from around the world up the famed mountain to enjoy breathtaking views.

The Cog has run from a base station a few miles from what is now the Omni Mount Washington Hotel (310 Mount Washington Hotel Road, Bretton Woods, N.H.) and Bretton Woods Ski Area. Guests could — and still can — arrive and enjoy the beauty of the mountain base then climb aboard to be chugged upward, past lush mountain scenery, past the tree line and then out to a mountain peak that — on a clear day — offers views of five states and Canada.

The Cog was the world’s first mountain-climbing railway, and to this day remains the second steepest rack railway in the world, with an average grade of over 25 percent and a maximum grade of 37.41 percent. The railway is approximately three miles long and ascends Mount Washington’s western slope, beginning at an elevation of approximately 2,700 feet above sea level and ending just short of the mountain’s summit peak of 6,288 feet. That starting elevation means a cool escape on warm summer days, and changing tree colors early come fall days. The peak? One of the most talked about weather stations in the world is there — and guests might experience any kind of weather on any given day, adding to the thrill.

The Cog runs several trips daily (varied hours throughout the season can be found at thecog.com). Guests arrive at the lovely base area buildings where they can enjoy a bite to eat, take in some history of the Cog or just soak in the surroundings. Once aboard the train, they are treated to a three-hour journey — about one hour up, an hour to enjoy the peak area’s views, state park and museums and another hour back down.

The train ascends the mountain at 2.8 miles per hour and descends at 4.6 mph (It takes approximately 65 minutes to ascend and 40 minutes to descend, although the biodiesel engine can go up in as little as 37 minutes).

As you head up and down, you pass through thick trees, rocky areas and spectacular vistas. The historic “halfway” house is a site worth viewing, as is “profile rock,” a man-made recreation of New Hampshire’s famed Old Man of the Mountain. For extra thrills, there’s “Jacob’s Ladder,” a S-bend curve that is the steepest part of the railway and an iconic moment in every ride up and down.

This 150th birthday summer, the Cog will hold a 150th Celebration Gala at the base station on June 22, featuring historic presentations, toasts, fireworks and more. Sylvester Marsh’s great-grandson Richard Joselin, an author and an architect from Cambridge, is expected to attend.

Then, on July 3, the actual 150th anniversary, the public is invited to a free Fun Day at the base station. There will be lawn games, food, fireworks and more.

Of course, the best way to celebrate is to ride the Cog. While there have been updates over the years (some of the trains now run on biodiesel), the feel, the view and the experience remain as special as the one Sylvester Marsh envisioned a century and a half ago. Tickets start at $72 for adults, $68 for seniors and $41 for children (depending on the season). Just to spice things up, this season, every 150th person booking a ride pays the original round trip price of $3.

The Cog remains one of the state’s most beloved and sought-out tourist attractions. For details on events, booking rides and where to stay while visiting, go to thecog.com.