For a long time, being debt-free was a huge part of my identity. I paid off my student loans years before any of my peers, many of whom are still paying for their college educations.

In fact, paying off my student loans in three years on a modest salary while living in Indianapolis even helped launch my writing and teaching career. My story inspired some, educated others, and generally gave me a sense of accomplishment I’d never experienced before.

Now I wonder if it was all a mistake.

Don’t get me wrong: I’m still proud that I don’t owe money anymore. But I’ve also realized that my intense focus on paying off debt came at the expense of funding my retirement account.

In my rush to complete a somewhat arbitrary goal, I doomed myself to playing catch up in my 20s.

How I did it

I paid off $28,000 worth of student loans by living frugally, tracking my expenses, and sticking to a budget. I rarely went to bars or restaurants–even while my friends were all out having fun, and forget about vacations, or buying new clothes.

I bought used clothing from second-hand stores when I could. I shopped for groceries at Aldi instead of Whole Foods, and looked for free samples every time I went to Sephora.

I also avoided taking on more debt, paid for everything I needed in cash and continued to drive the same 1999 Toyota Avalon I had in college until 2014. Any time I got extra money, I put it toward my loans. During the last year of my loan repayment, I was putting half of my paycheck toward my debt.

In November 2014, I became debt free.

Did I do the right thing?

During that time, I also mostly delayed saving for retirement. I had a three-month emergency fund to act as a buffer in case I lost my job or had a medical emergency, but I didn’t start a 401(k) until I was two years into my debt repayment journey.

Even then, I only began saving because my new job offered a 3% match if I put in 6%. I didn’t want to give up free money. The interest rate on my loans was 6.55%, which I thought was too high to only pay the minimum payment each month.

Financial advisor Kevin Matthews of the New York-based advisory Building Bread, told me I could have been investing from the get-go, even if it meant delaying paying off my debt. He estimates I would have an additional $60,000 in my 401(k)* if I had only paid the minimum on my loans and invested the rest, instead of making all those extra loan payments.

“There is nothing inherently wrong about paying off your loans early, but I would warn against it if you’re ignoring your investing altogether,” Matthews said. He told me the amount I paid toward my student loans above my minimum payment could have grown more than the interest I was charged on the loans.

At the same time, not every advisor agrees.

Financial planner Jeff Rose a certified financial planner for GoodFinancialCents, in Nashville said paying off my loans quickly was the right move, because freedom from debt is more satisfying than any return in the stock market.

“There’s no financial calculator that can compute the value of what it means to be debt free,” Rose told me. “Paying off all of your debt is an accomplishment that should never be associated with regret.”

Would I do it the same way again?

Having no debt is an amazing feeling, but I do wish I had a bigger nest egg. If I could go back in time, I would have put aside 5% in my 401(k) every month. I would have also tried to refinance my student loans so I could get a lower interest rate and have more money to add to my loans or retirement account.

That’s what I would tell anyone else who has student debt now. Pay off your loans early, yes, but don’t forget about retirement. That lesson is even more crucial if your debt repayment will take five years or longer – you don’t want to give up all those years of compound interest.

Even if you think you don’t need to worry about your retirement right now, you’ll be happy you got an earlier start.