A vending machine containing essentials for rough sleepers has been installed in Nottingham in what is believed to be a world first, with the inventor hoping to put one in every city with a homelessness problem.

The machine was unveiled at the Intu shopping centre in Broadmarsh on Tuesday. It dispenses water, fresh fruit, energy bars, crisps, chocolate and sandwiches, as well as socks, sanitary towels, antibacterial lotion, toothbrush and toothpaste packs, and books.

Much of the fresh food comes from redistribution organisations seeking to reduce food waste, according to the inventors at Action Hunger, a new charity. Other items are bought with donations.

Use of the machine is exclusively for those in need, and items can only be vended with a special keycard, which Action Hunger’s partner organisations give to users. In Nottingham the cards are given out by the Friary, a drop-in advice centre for homeless people.

The keycards are programmed to permit up to three items being dispensed per day. The limit aims to stop “dependency” on the machines, the charity said.

“We want our low-cost solution to complement other services that are available, as engagement with professionals and local support services is instrumental to breaking the cycle of homelessness,” it added.

The machine was the brainchild of Nottingham local Huzaifah Khaled, 29, who developed the project while undertaking a PhD in law.

He persuaded one of the world’s biggest vending companies, N&W Global Vending, to give him a £10,000 machine for free, and got the Friary on board in Nottingham.

Khaled has been criticised for enabling a street lifestyle by making it easier for people to sleep rough, rather than seek sanctuary and help in a hostel, where they can receive healthcare and advice. But he insists the opposite is true.

“We could have not put a limit on how many items people could receive, and not built in a system of checks. All of our users in Nottingham have to check-in with the Friary once a week for their cards to continue working,” he said.

The machines were restocked daily by a team of volunteers. Eventually 100 cards would be issued in the city, Khaled said.

He hopes to expand across the country as quickly as possible, if he can raise capital. Action Hunger should have 25-30 machines in use by the end of 2018, he added.

The programme will be rolled out across the US next year, with two being machines installed in New York in February and Los Angeles, San Francisco and Seattle to follow.

Khaled said he was in discussions with Network Rail to install machines at train stations, which he said could be the “ideal solution” because most had long opening hours and were safe and well lit.

Since the news spread, he has been approached from people all over the world wanting to install a machine in their city, he said. “I’ve had emails from people in Greece, Spain, Australia and China, all wanting to know more.”

Now he just needs to find someone to run the charity and raise the money necessary for the global rollout: he takes up a full-time job with Goldman Sachs in February.