A young adult novel inspired by both the Black Lives Matter movement and the rapper Tupac Shakur has won the Waterstones children’s book prize.

Angie Thomas’s debut The Hate U Give won the £5,000 prize, an accolade decided entirely by booksellers, at a ceremony in London on 22 March. Following Starr, a teenage girl split between the poverty of her childhood and the affluent high school she attends, The Hate U Give explores racism and the aftermath of police violence when Starr witnesses the fatal shooting of an unarmed friend at the hands of an officer.

The novel takes its title from a quote from the late Shakur, who once said that Thug Life – the name of his group and only studio album – stood for the phrase: “The Hate U Give Little Infants Fucks Everybody.”

In his review for the Guardian, author Alex Wheatle described the story as “beautiful”. “The Hate U Give is an outstanding debut novel and says more about the contemporary black experience in America than any book I have read for years, whether fiction or non-fiction,” he wrote.

Thomas, who was born and lives in Jackson, Mississippi, originally wrote the book as a short story but was inspired to expand it in 2015, by her anger at the deaths of several black Americans at the hands of police offices – which also sparked the Black Lives Matter movement, a campaign against violence and systemic racism towards black people.

In an interview with the Observer in 2017, Thomas said she felt it was important for young adult books to explore police violence. “So many teenagers are affected by these cases. It’s usually young, unarmed black people who lose their lives. Trayvon Martin was 17, Mike Brown was young, Tamir Rice was 12. And so young people are affected by it, possibly the most affected, because they’re seeing themselves,” she said.

Waterstones managing director James Daunt said The Hate U Give deserved a readership wider than only young adults. “Ours is a children’s prize, but there is no upper age limit to being stunned by beautiful writing of this visceral power. It is an extraordinary achievement, and it triumphs in a year of wonderful quality and creativity in children’s publishing,” he said.

Children’s book buyer Florentyna Martin called it “outstanding piece of writing and an incredibly gripping read”.

“This book has provided an important step-change in children’s publishing and our booksellers have championed this from the get-go. Angie Thomas has an incredible writing skill, impeccably adapting her tone of voice for each individual character and situation. She is a unique and powerful new voice for teenagers and adults and this book will undoubtedly be discussed for years to come,” she said.

Thomas, who is also shortlisted for the 2018 Carnegie medal, took out the top prize after winning the older fiction category earlier in the night, alongside Jessica Townsend’s fantasy novel Nevermoor, which won best younger fiction book, and Joe Todd-Stanton’s picture book The Secret of Black Rock, which won the illustrated book category.