I didn’t realize it then, but my “perfect” friendship was actually causing small pockets of loneliness in my life.

When my best friend told me he was having trouble getting out of bed, completing regular tasks, and finishing his residency applications, the first thing I did was look up flights. It wasn’t even a debate on my end.

At the time, I was living in Karachi, Pakistan. He was in medical school in San Antonio. I was a freelance writer with ample flexibility. He needed me. And I had the time.

Three days later, I was on a 14-hour flight, and opening my journal to record a phrase from the book I’d been reading. That’s when I noticed a sentence I’d written less than a year before.

This wasn’t the first time I’d dropped everything to help him out. As I flipped through the pages of my journal, I began to notice this reflection wasn’t a second or third time thing. While I was giving my whole self to him, I somehow always got left behind once his life recovered from being in shambles.

Read more: How to help someone with an alcohol addiction »

I don’t remember when I first realized that our relationship wasn’t healthy. What I can remember, though, is learning that there was a name for what we were: codependent.

According to Sharon Martin, a psychotherapist in San Jose, Calif., who specializes in codependency, codependent relationships are not a diagnosis. It’s a dysfunctional relationship where one person loses themselves in their attempt to take care of someone else. Somewhere down the line, or from the beginning, one person becomes the “codependent” and ignores their own needs and feelings. They also feel guilty and responsible for tackling the other person’s problems and solving their concerns.

Enabling is often accidental, but often, instead of allowing their partners to learn from their mistakes, they swoop in and “fix” everything, never allowing the other person to truly experience rock bottom.

This basically summed up my relationship with my best friend.

Read more: What do you want to know about mental health? »

In Karachi, I was miserable, haunted by the life I’d left back in the United States. I missed sitting in coffee shops and drinking at bars with friends on the weekends. In Karachi, I was having a hard time connecting with new people and adjusting to my new life. Instead of trying to be proactive about my problems, I’d spent all of my time trying to fix and shape the life of my best friend.

No one around me had ever explained that a friendship could be unfulfilling and unhealthy. I thought being a good friend meant showing up no matter what. I would avoid making other plans with others friends who lived in the same time zone as me in order to be there for him. Most of the time he let me down.

Sometimes I would stay up until 3 a.m. in case he needed to speak to me, but I’d just spend that time worrying about what’d gone wrong. But none of my other friends were spending their own money to fix someone else’s life. Nobody thought they needed to know where their best friend was at every point of the day.

My friend’s mood also tended to affect my entire day. When he messed up, I felt personally responsible — as though I should have been able to fix them. Things that my friend could and should have been doing himself, I did for him.

Leon F. Seltzer, a clinical psychologist, and author of the Evolution of the Self blog, explained that the “codependent” may have issues of their own that are often mitigated in this relationship.

All of these should have been warning signs, and with the help of some distance, I’m able to look at all of this objectively and recognize them as problematic behaviors. But while I was in the relationship, worried about my best friend, it was hard to notice that I was actually part of the problem.

During so much of this friendship, I felt terrifyingly alone. This, I learned, is a common feeling. Martin acknowledges that, “Codependents can feel lonely, even in relationships, because they aren’t getting their needs met.” He also says that it’s never entirely one person’s fault.

Codependent relationships often form when there’s a perfect combination of personalities: One person is loving and caring, genuinely wants to take care of the people around them, and the other needs a lot of taking care of.

Most codependents don’t have that, and as a result, they end up feeling lonely, even during the relationship. This described me perfectly. Once I realized that my friendship was no longer healthy, I tried to distance myself and reestablish boundaries. The problem was that both my friend and I, used to how things used to be, almost immediately disregarded the boundaries that we’d set up.

Finally, I told my friend I needed a reset. He seemed to understand that I was really struggling, so we agreed that we’d take some time apart. It’s been four months since we’ve spoken properly.

There are moments when I feel completely free, unburdened by many of the problems he faced in his life. Yet there are other moments where I miss my best friend.

What I don’t miss, though, is how much he needed me, and the large part of my life he took up. Breaking up with my friend gave me the space to make some much-needed changes in my own life. Mostly, I’m surprised by how much less lonely I feel.

I have no idea if we’ll ever go back to being friends. Everything’s changed. Martin explained when the codependent learns to set boundaries, they no longer become consumed with the other person’s problems. As a result, the entire direction of the friendship changes.

I’m still learning to stick to my boundaries, and until I’m confident that I won’t fall back into my old behaviors, I’m wary of reaching out and speaking to my friend.

Mariya Karimjee is a freelance writer based in New York City. She’s currently working on a memoir with Spiegel and Grau.