ST. PETERSBURG — The path that eventually led Nick Anderson to the major leagues as a 29-year-old rookie and — via a recent trade, to a key role in the Rays bullpen — included a lot to feel good about.

How he was undrafted out of high school, barely noticed in college, spent three seasons pitching in independent leagues and one summer in the middle playing for an amateur town team while doing home remodeling before getting his chance is a story of remarkable perseverance and dedication.

But it was the 2011 night when so much went bad that may have shaped Anderson the most.

When alcohol got the best of him again, when he joined his buddies in a fight, hit someone over the head with a bat, ended up charged with second-degree assault, spending time in jail, undergoing counseling and on probation.

“Obviously I feel bad about that,” Anderson said after joining the Rays. “But if I wouldn’t have gone through that and realized things and self-reflected and grew up, who knows what could have happened.

“I could have ended up killing myself somehow. Or killed somebody else. Who knows where it could have gone.

“So in that aspect, nobody was severely harmed. Nobody died. So I look at it like, Hey, somebody was trying to tell me something, whether it was God or what. Somebody was trying to teach me something. I took a lot of things away from it and had a lot of time to self-reflect and make changes and adjustments and become an adult a little bit.”

The incident took place in his native Minnesota, where he was pitching for St. Cloud State, having just turned 21.

From the way Anderson tells it, at the end of another long night “in the college trap of partying all the time,” his close friends getting in an altercation, him jumping in to help them, seeing someone on the other side with a knife and grabbing a bat, swinging only “in a self-defense kind of way.”

Adjudication by the legal system led to a conviction on the misdemeanor charge, Anderson, per the Minneapolis Star-Tribune, spending eight days in jail, paying restitution to the victim, taking anger-management classes and attending Alcoholics Anonymous meeting while on probation, which ended in 2015.

Coming less than a year after a DWI conviction, Anderson disciplined himself as well, saying he realized then he had to take charge of himself.

“I took a lot from that and obviously I had to make life changes,” he said. “I wanted to play in the big leagues. I wanted to keep playing baseball. In order for me to do that, I had to stop drinking.”

Anderson, adamant he wasn’t an alcoholic, said he went about three years without a drink, which was a term of his probation that ended in 2015. But now, as a more mature adult, he said he drinks “socially,” with no issues or concerns.

There was additional fallout from the incident.

He transferred to Mayville (North Dakota) State to get out of St. Cloud, and though he pitched well enough for the Comets to get drafted in the 32nd round by the Brewers, he wasn’t signed in part because of his legal issues.

Instead, he was pitching for the Rockford (Illinois) RiverHawks (and then Aviators) of the independent Frontier League, and not particularly well at that. When a tryout with Sioux City (Iowa) Explorers of the indy American Association fell through in 2014, Anderson took a job working for a friend of a friend remodeling houses and played baseball just to play for the Tri-City Shark, a Minnesota men’s league team.

“I’d kind of lost that fun for the game the first couple years of indy ball trying to get into pro ball,” Anderson said. “I was just trying too much. The summer I just played amateur ball, I had a blast. I started having fun playing again.”

He went back to the Frontier League in 2015, playing for the Greys team that spent the entire season as visitors, with no home stadium. But he pitched well enough to catch the eye of Twins scout Bill Milos, who spent enough time talking with Anderson, and his probation officer, that he pushed that July for his signing.

At age 25, Nick Anderson was officially, finally, a pro baseball player, pitching for the Class A Cedar Rapids (Iowa) Kernels (and debuting, coincidentally, against the Rays Bowling Green affiliate on Aug. 8. 2015).

Through all that just to get to pro ball, Anderson said he remained undeterred of making it to the majors.

“To be honest, I didn’t really ever have the thought of quitting or hanging them up,” he said. “I really just played everywhere like, Hey, this is a stepping stone. I had the belief that it was going to happen at some point.”

He moved relatively quickly from there, with a solid 2018 season at Triple-A making the final step to the majors a realistic possibility. The Twins erred by not putting Anderson on their 40-man roster, instead sending him to Miami in what seemed like a minor deal for Double-A infielder Brian Schales.

But Anderson made it pay off in a major way. He made the Marlins opening day roster and posted some impressive numbers, mainly 69 strikeouts in 43.2 innings with a 2-4, 3.92 mark.

The Rays were impressed enough to make him the lone trade upgrade to their bullpen as they push for a playoff spot, swapping top-five prospect Jesus Sanchez and big-league reliever Ryne Stanek for Anderson and starter Trevor Richards (who was sent to Triple-A).

There were many steps on Anderson’s way. And that includes those very wrong ones that night in St. Cloud.

“If I wouldn’t have gone through that,” he said, “who knows if I’d be where I’m at right now.”