Keira Knightley is adding “author” to her resumé.

The “Atonement” star has just published her first children’s book, “I Love You Just the Same,” which is out now in her native UK and will be released stateside next summer by Gallery Kids/Simon & Schuster.

The picture book is both written and illustrated by Knightley, 40, who tells a whimsical story about a young girl that wishes her new baby sister would be carried away by birds. But when it actually happens, the guilt-ridden girl embarks on a journey to retrieve her little sibling.

The project was inadvertently born roughly five years ago, thanks to Knightley’s two daughters with husband James Righton: Edie, 10, and Delilah, 6.

“It was a complete accident,” Knightley tells USA TODAY, in a recent interview for her Netflix thriller “The Woman in Cabin 10” (now streaming). “My eldest kid didn’t sleep very much, and we tried many different nighttime routines to try and get her to sleep. Eventually, I came on this idea that if I drew her a picture every night, then when she’d gone to bed, I’d leave it in her room.”

Keira Knightley attends the New York premiere of "Boston Strangler" on March 14, 2023. The two-time Oscar nominee just released her first children's book.

Keira Knightley attends the New York premiere of “Boston Strangler” on March 14, 2023. The two-time Oscar nominee just released her first children’s book.

When Edie would “wake up, she knew that I’d been thinking about her,” Knightley continues. “So every night before bed, she’d tell me what picture she wanted me to draw.”

The pictures got more and more creative over time, as Edie asked her mom to draw babies, cats and birds.

“Then one day, when her sister was about 6 months old – she’d been crying a lot because she was teething – she said, ‘Can the bird take the baby away?’” Knightley says with a laugh. A story began to take shape, “and I thought, ‘Maybe I can push this a bit further and make it more universal about sibling rivalry and separation anxiety.’ So that’s what I ended up doing and I loved every bit of it. It was such a joyous thing to do.”

Coincidentally, “I Love You Just the Same” was greenlit by the publisher the same day Knightley started production on Season 1 of her Netflix spy series “Black Doves.” The actress has a trick to memorizing lines, where she records her dialogue and then listens back.

The cover of Keira Knightley's new book "I Love You Just the Same," which will be released in the U.S. next year.

The cover of Keira Knightley’s new book “I Love You Just the Same,” which will be released in the U.S. next year.

“That’s literally what I was doing the whole time making ‘Black Doves,’” Knightley says. “I would listen to my lines while I was drawing the illustrations for the book. It was kind of a weird juxtaposition: drawing a lovely pigeon at the same time as I’m learning lines where I’m about to kill somebody. (Laughs.) It was quite nice to have those two things going on at once.”

The two-time Oscar nominee jokes it took her “too long” to make the book, in that Edie has now grown out of it.

“I started it when she was 5, because we were doing it in a way where it was just between us and it wasn’t this whole thing,” Knightley says. “She’s so bored by it now. She’s like, ‘Has that book come out yet?’ And I’m like, what is the matter with you?!”

Keira Knightley is now shooting Season 2 of her Netflix spy series "Black Doves."

Keira Knightley is now shooting Season 2 of her Netflix spy series “Black Doves.”

Delilah, meanwhile, has given her a thumbs up.

“She was a baby when we started and she’s 6 now,” Knightley says. “She’s like, ‘Well done, Mummy! I like your book!’ And I’m like, ‘Thank you!’ (Laughs.) That’s what I need.”

This article originally appeared on USA TODAY: Keira Knightley says first children’s book was a ‘complete accident’