NASHVILLE — Country music star Kelsea Ballerini was in Los Angeles on a rare night off last year and decided to call a couple friends — at least one of whom happened to be a celebrity. No one picked up. Anxious thoughts started to race.

“I went into this spiral of like, ‘Oh my God, why did I think I was cool enough to call Taylor Swift? That was so embarrassing, of course she didn’t pick up. Why am I even out here? Why am I writing songs in L.A.? What if I put a beat drop on these songs? Is Nashville going to be mad that I have a beat drop on these songs instead of a banjo? Should I be home right now?” Ballerini, 26, recalled during a recent interview.

To calm down, she turned to the therapeutic method she has used since she was 12 years old: songwriting. She didn’t have a guitar with her, so she wrote a poem: “Sometimes it feels like it’s all real, but nothing here is as it seems / I ask myself, does it feed my soul or my anxiety?” The lines eventually turned into the lyrics for “LA,” the final track on her third studio album, “Kelsea,” released Friday.

“Kelsea,” which features songwriting collaborations with Nashville writers along with Ed Sheeran and Julia Michaels, is deeply personal as it dives into Ballerini’s insecurities and vulnerabilities. They might seem like unusual topics, given that Ballerini is at the height of her success: She’s had Grammy nominations, a string of No. 1s on country radio, a headlining arena tour, two certified-gold albums, a platinum-selling duet with the Chainsmokers (“This Feeling”) and stints on TV shows including “The Voice” and “Songland.”

But it’s been a long road. When Ballerini was in high school and traveled from Knoxville, Tenn., to Nashville to see if her love of songwriting could turn into a career, label executives were puzzled when they saw a blond teenage country singer with a guitar. Didn’t they already have Swift? After many doors shut in her face, she was determined to make her music stand out. Her first hit, “Love Me Like You Mean It,” was bursting with self-confidence, and similar “bops” (Ballerini’s word) such as “Dibs,” “Yeah Boy” and “Miss Me More” followed suit. But this new record intentionally has a more introspective tone, Ballerini said, because she finally took a break from nonstop touring and had time for self-reflection.

“I had to get to know myself at 26 and realize that I’m not the same person who wrote the first or second albums,” Ballerini said. “I still have bits of that confidence and that swagger in this album. But it’s definitely paired with a lot more truth-telling.”

Even though Swift’s presence loomed large when Ballerini launched her career, the two became good friends and share a sensibility about fans: If you can relate to them on the most basic level, they will be loyal to you for life.

For years, Ballerini’s loyal fan base (now 3 million combined followers on Instagram and Twitter) has witnessed her go from playing clubs to selling out arenas, saw photos from her oceanside wedding to country singer Morgan Evans, and watched her cry with her mom when her second record, “Unapologetically,” received a Grammy nomination for best country album. But they have also seen her have dance parties, indulge in her love of fast-food chicken nuggets, watch “The Bachelor” and take her dog, Dibs, for walks in the rain.

“Since I first started, I was always like, ‘I just want to be the same person that I am out with my friends or on the couch with Morgan and Dibs that I am onstage,’” Ballerini said. “There’s also a lot of people that I’m seeing right now that are overly filtered, and I don’t want that to be what young girls are thinking is normal.”

Ballerini has always been candid about her challenges, even as she hit her stride. She admitted on Bobby Bones’s podcast in 2017 that she felt like some people in Nashville didn’t find her very “cool” because of her pop-infused country songs. Earlier that year, after performing on the Academy of Country Music Awards, she posted a defiant Instagram caption: “I wear a lot of glitter, I have bass drops and programmed beats in my songs and performances. But ya know what, I write, sing, and LOVE country music.”

So when writing this album, Ballerini doubled down on exploring tough questions: “Why am I so anxious all the time? Why all of a sudden am I the most insecure person that I know?” She realized if she was having those feelings, other people probably were too, no matter their level of success. It all culminated during a weekend while she was touring last year with Kelly Clarkson and invited top Nashville songwriters Nicolle Galyon and Jimmy Robbins to join her for a few days on the road.

“For different reasons, we were all in really vulnerable places,” Galyon said. As the three brainstormed ideas, something clicked as they shared personal details. She and Ballerini both cried. Over those few days on the tour bus, they wrote songs that altered Ballerini’s entire idea for the album. “I think we knew and she knew that she had begun writing the record.”

They wrote a ballad called “Homecoming Queen?” about the facade of perfection: Just because things in your life are going right, it doesn’t mean you’re devoid of pain. (“What if I told you the world wouldn’t end? If you started showing what’s under your skin? / What if you let ’em all in on the lie? Even the homecoming queen cries.”)

Ballerini’s transparency comes through in other tracks: her nerves about connecting with people on “Overshare”; social anxiety on “Club” (and the realization in your mid-20s that nightclubs are the worst; feeling jealous on “The Other Girl,” which features pop star Halsey. However, she felt that “Homecoming Queen?” so perfectly captured the tone of the album that she wanted to release it as the first single, a risky move in a genre often wary of ballads. But it’s currently in the Top 20 at country radio.

“It wasn’t the traditional bop that I normally put out,” Ballerini said. “But I think it was time for me as a songwriter to really show that side of myself.”

Shane McAnally, one of Nashville’s most successful songwriters and Ballerini’s frequent collaborator, was in awe of her writing skills the first time they met. “She would be having hits everywhere with other people if she wasn’t cutting them herself,” he said. “She’s that good.” (Galyon agreed, adding, “I’ve joked that if Kelsea wasn’t so busy being a superstar, she would steal my job.”)

This record features the most “traditional” country songs Ballerini has ever had on an album: the pointedly named “A Country Song”; drinking jam “Hole in the Bottle”; and “Half of My Hometown,” which, to her amazement, features backup vocals from country superstar Kenny Chesney. The two of them connected years ago when Chesney, a fellow Knoxville native, texted her a picture he saw of her on a billboard in New York City and wrote, “Proud of you, hometown girl. Love, Kenny.”

“I didn’t know that he even knew who I was,” Ballerini said. Now that she’s in a position of power, she has the same support for newer artists. When a country radio programmer recently went viral for admitting that her station was barred from playing two female singers in a row (an unspoken rule of thumb in country radio, where women make up only 10 percent of airplay), Ballerini wrote a long Instagram post and called it “unfair and incredibly disappointing,” especially on behalf of newer singers trying to break in the business.

At first she was hesitant, given her radio success — yet she knew this was the time to use the large platform she’s earned over the years. “I never wanted to say anything that would sound ungrateful,” she said. “But when you see something that blatant . . . that was when I need, with as much grace as possible, to try to protect this next round of females that are moving to Nashville.”