Image copyright Getty Images Image caption The star attended the gala premiere of her documentary in Utah on Thursday night

Taylor Swift has opened up about her struggle to overcome an eating disorder in a new documentary about her life.

In Miss Americana, which premiered at the Sundance Film Festival, she said photographs and comments about her appearance had triggered the condition.

During her 2015 world tour, under-eating left her feeling "like I was going to pass out at the end of a show, or in the middle of it," Swift said.

"It's only happened a few times and I'm not in any way proud of it," she added.

Swift said she struggled with the condition for several years. Some days, she would "starve a little bit [and] just stop eating". The rest of the time, she kept lists of everything she ate and exercised constantly until she was a size double-zero (size two in the UK).

But she denied having a problem when people confronted her about her weight.

"I would have defended it to anybody: 'What are you talking about? Of course I eat. I exercise a lot,'" she said in the film.

"And I did exercise a lot. But I wasn't eating."

Swift elaborated on the origins of her eating disorder in an interview with Variety magazine that coincided with Miss Americana's premiere.

"I remember how, when I was 18, that was the first time I was on the cover of a magazine, and the headline was like 'Pregnant at 18?'" she said.

"And it was because I had worn something that made my lower stomach look not flat. So I just registered that as a punishment.

"And then I'd walk into a photo shoot and be in the dressing room and somebody who worked at a magazine would say, 'Oh, wow, this is so amazing that you can fit into the sample sizes. Usually we have to make alterations to the dresses, but we can take them right off the runway and put them on you!' And I looked at that as a pat on the head.

"You register that enough times, and you just start to accommodate everything towards praise and punishment, including your own body."

The star says she now practises positive thinking when she is tempted to judge her body, telling herself: "Nope. We do not do that anymore because it's better to think you look fat than to look sick."

Political awakening

Miss Americana, which comes to Netflix on 31 January, received a standing ovation after its gala screening in Utah on Thursday night.

Afterwards, director Lana Wilson praised Swift for being so candid about under-eating.

"That's one of my favourite sequences of the film," Wilson said. "I was surprised, of course. But I love how she's kind of thinking out loud about it. And every woman will see themselves in that sequence. I just have no doubt."

"I think it's really brave to see someone who is a role model for so many girls and women be really honest about that. I think it will have a huge impact."

Image copyright Getty Images Image caption The star says she is a healthier weight now than in the mid-2010s when she "starved" herself

Wilson's candid documentary follows Swift during a turbulent period of her life, opening with a scene where the star learns her 2018 album Reputation has been snubbed by the Grammys.

The incident acts as a framing device, as the star realises she needs to stop trying to please everyone else and focus on what makes her happy.

Wilson pays particular attention to Swift's political awakening, as she sues a Colorado disc jockey for sexual assault and begins to speak out against conservative lawmakers.

She expresses regret for not opposing Donald Trump in the 2016 election for fear it would alienate fans; and meets with opposition from her team when she decides to endorse the Democrats in Tennessee's 2018 elections.

As she is about to press send on an Instagram post about Blackburn, her publicist warns that "the president could come after you".

Swift replies with an expletive, adding: "I don't care."

Image copyright Getty Images Image caption Swift's Reputation album and tour saw her fight back against negative press and internet trolls

The documentary also includes some tender moments, with Swift describing how she fell in love with British actor Joe Alwyn.

The star says she was attracted by his "wonderful, normal, balanced kind of life," and that he helped anchor her during one of the most difficult periods in her life.

However, critics felt that the officially-approved documentary only skimmed the surface of Swift's true story.

"Swift's awareness of her public persona and how she's perceived gives Miss Americana a low-hum of image management, which in turn makes you question the authenticity of Swift," wrote Matt Goldberg on Collider.

"The trouble with Miss Americana is that, although there is honesty and vulnerability, there's also something rehearsed and distant about it," agreed Screen Daily's critic Tim Grierson.

"Swift invites us in, but she only lets us see so much."

Follow us on Facebook, or on Twitter @BBCNewsEnts. If you have a story suggestion email entertainment.news@bbc.co.uk.