Miranda Lambert wrote her new hit Bluebird just after telling her songwriting partners about her secret wedding to New York police officer Brendan McLoughlin.

The country star was in the studio with Luke Dick and Natalie Hemby when she broke the big news, three days after quietly tying the knot.

"I spilled the beans to the two of them that I got married because I’d kept it a secret," Miranda told Billboard.

"So that same day we were writing that song (and) I’m bursting at the seams: 'I have to tell y'all a secret!'" she laughed.

Bluebird's origins come from a poem, she continued: "Luke had texted us a group text. We're always on a thread. And he sent those lines from Charles Bukowski’s poem The Bluebird. He was like, 'Maybe there’s something to this."

Miranda insists her new marriage excitement helped turn the song into something special: "Those are some big lyrics to try to build around, and so we wanted to make sure we did a good job of that."

Crediting her creative partners, she added: "It's always fun writing with them. Sometimes it's hard and when it gets hard is when we know we're about to get something good."

Miranda admitted wine helped when inspiration ran dry for the songwriters: "As soon as (we) are all talking about what kind of jobs are we going to do since we can't write songs anymore, clearly something magical comes out of someone’s mouth and then we're back on track. Or we take a rose (wine) break. That also helps."