Image copyright Getty Images Image caption Public toilets have proven notoriously difficult to maintain worldwide

Starbucks has amended its toilet policy to allow anyone to use the facilities - whether or not they purchase something - following a row over the treatment of black customers.

But the move by the US coffee chain could open the door to other problems including drugs, prostitution and homelessness.

Starbucks chairman Howard Schultz announced on Thursday that the company's toilets would be available to anyone who asked.

"We don't want to become a public bathroom, but we're going to make the right decision 100% of the time and give people the key," Mr Schultz told the Atlantic Council, a think tank in Washington DC.

"We don't want anyone at Starbucks to feel as if we are not giving access to you to the bathroom because you are 'less than'."

Media playback is unsupported on your device Media caption Watch the arrest of two black men at Starbucks - and the protests that followed

Why did Starbucks decide to change its policy now?

On 12 April, the manager at a Philadelphia Starbucks called the police on two black men who had requested to use the toilet without making a purchase. They were waiting for a business meeting and were arrested when they refused to leave.

The subsequent outcry led to a settlement with the city and a public-relations disaster for Starbucks. The company apologised to the men and later this month will shut for one afternoon all 8,000 US stores as it holds mandatory anti-racial bias training for staff.

Starbucks told the BBC in an email that employees were currently being instructed to "ensure that all customers coming in feel welcome" and if someone needed to use the toilet, to let them unless it seemed unsafe.

It is unclear how this change would affect customers with disabilities in terms of ensuring ready access to disabled toilets.

Why were the toilets locked in the first place?

Starbucks is far from the only US business to keep its toilets under lock, wanting to avoid them being used as "public bathrooms".

Aside from vandalism concerns, public toilets need constant maintenance to stay functional, let alone hygienic.

For many businesses, asking customers to pay for goods before requesting toilet access helps cover maintenance costs.

More concerning than cleanliness is the prevalent drug use and prostitution in public facilities.

Media playback is unsupported on your device Media caption The heroin-ravaged city fighting back

A 2013 study of New York City businesses found that 58% of store managers had seen drug use in their toilets.

Over the last year, US media have called public lavatories the new frontline of the opioid epidemic.

The city of Seattle spent $5m (£3.6m) on five self-cleaning toilets in 2004, only to close them four years later due to rampant drug use and prostitution.

One woman even told the New York Times that she used to smoke crack cocaine in the toilets but stopped because they were too "disgusting".

But for those without a home, public facilities are often the only ones they have access to.

According to the National Alliance to End Homelessness' 2017 statistics, there are more than 500,000 homeless people in the US, with 34% living on the streets.

Maria Foscarinis, executive director of the National Law Center on Homelessness and Poverty, told the BBC that Starbucks' new policy would "make a big difference for people who are homeless".

"People who are homeless are disproportionately members of racial minorities," Ms Foscarinis said, adding it would be an opportunity for Starbucks to include homeless anti-bias information during the forthcoming training day.

Image copyright Getty Images Image caption Los Angeles is home to more than 34,000 homeless residents, most of whom live on the streets of the Skid Row neighbourhood

What can be done to solve these issues?

Ms Foscarinis said that some cities had now begun to address the public lavatory issue after health crises such as a recent hepatitis outbreak in California that killed 19 people.

"This is something we all have in common. This is part of the human condition. This is a basic human need that needs to be addressed for people without any other alternative."

In 2017, Los Angeles opened a hygiene centre in the Skid Row neighbourhood, offering toilets and showers for more than 34,000 homeless people.

The $450,000 facilities are guarded by security personnel and have a maintenance crew.

Drug use can be trickier to prevent.

Back in 2003, the BBC reported on how a Sainsbury's supermarket in Huntingdon, UK, installed blue lights in its toilets to combat drug use.

The blue lights prevent veins from showing up on arms, which successfully deterred drug-injecting users.

The same principle has been used in the US city of Portland, Oregon, where public toilets built in 2012 specifically addressed the problems of Seattle's toilet fiasco.

Dubbed the Portland Loo, these public facilities tackled the biggest issues - illegal activities and high-volume usage - via minimalism.

The stainless steel loos have slanted openings at the top and bottom that allow police to look inside if need be, no sink or mirror, a tap on the outside offering only cold water, a graffiti-proof coating, and blue lights. It is also disabled-accessible.

Image copyright The Portland Loo/Facebook Image caption "Too much privacy allows people to get away with things you shouldn't be doing in the restroom," Mr Madden said regarding the Loo's open design.

"Cities don't offer public restrooms because they offer more problems than they solve," Evan Madden, sales manager for the Loo, told the BBC.

Mr Madden said the toilet was designed by the community - police, fire, parks and recreation staff as well as toilet designers.

The Portland model is now in 21 cities across the US, with more scheduled for installation.

"A restroom that deters crime and is easy to clean would solve the problem of most public restrooms," Mr Madden said.

Perhaps the US could learn from Japan when it comes to keeping toilets clean, safe and accessible.

Japanese toilets are famously high-tech and sanitary, and the country even has a toilet museum.

But there is always room for improvement: in 2015, the Japanese government offered a Japan Toilet Prize (in Japanese) during a campaign to improve toilet quality across the country.