It doesn’t happen all the time, but it’s not unheard of in Philadelphia.

A homeowner returns after being away — maybe he took a vacation or perhaps she was admitted to the hospital — and finds a stranger living in the house, a stranger that won’t leave.

In the past, the process for getting rid of a squatter took time, often several months to more than a year. Now, thanks to a new but controversial city law, the matter could be settled within 30 days.

“It provides a solution, when there’s evidence of criminality, and the police do not take action,” said City Councilman David Oh, who introduced the bill that became law on Thursday without Mayor Jim Kenney’s signature.

A spokeswoman said the administration agrees with “the spirit of the legislation.”

Under the measure, homeowners can schedule a civil hearing in Common Pleas Court after they file an affidavit saying they’re the rightful owner of the property and that the squatter has no legal right to live there.

(The affidavit is also filed with the Philadelphia Police Department, so police can launch their own investigation.)

If the judge sides with the homeowner, he or she can order the trespasser to leave and impose a fine of up to $300 a day and potentially 90 days in jail.

Anyone who abuses the law is subject to the same penalties.

“It may not be perfect, but now at least we have something to work with,” said Joseph Rey, board president of the Greater Philadelphia Association of Realtors.

During his 26-year career as realtor, Rey has heard a number of nightmare scenarios about squatters victimizing homeowners.

In one instance, an owner moved into a new home; while he waited to settle with the buyers on the old one, someone broke into the property and refused to leave, upending the move.

Rey has also heard plenty of stories about what he calls “professional” squatters – people who illegally move into someone’s home, then demand money to move out. Then, they slip into another property and start the process again.

“Basically, it’s extortion,” said Rey.

Law inspires some worries

Housing advocates fear the law will do far more harm than good – to homeowners and legal tenants.

On a Friday morning in 2014, Ronnette Porter knocked on Morris Simpkins’ front door and told him he had to leave. She had purchased his childhood home in North Philadelphia at a sheriff’s sale.

Simpkins, who inherited the two-story row home after his parents died, was stunned.

“I told her ‘no.’ Get off my property,” he said.

Simpkins was the legal owner, but not the owner of record because the probate process was never completed.

The house on West Harold Street was put up for sheriff’s sale because he was delinquent on his property taxes.

In the end, after more than a couple run-ins with Porter, Simpkins was able to hold onto the home he shares with his wife because he exercised what’s known as his right of redemption, which allowed him to make Porter whole by paying off the back taxes and the money she laid out for the property – roughly $9,000.

But under the new law, once Porter got the sheriff’s deed, Simpkins would be considered a criminal trespasser because he wouldn’t have permission from her to live there, said Jennifer Schultz, Simpkins’ attorney.

Porter could not be reached for comment.

Under the law, a homeowner can also file for an emergency hearing within five days of filing an affidavit. George Donnelly, an attorney with the Public Interest Law Center, said that could easily lead to landlords circumventing the legal eviction process, which typically takes a couple of months to complete.

“What we’re very worried about happening is that the worst landlords, especially those renting to people at the lowest rungs of the rental market, those folks, instead of being removed by the eviction process, which is already fast-tracked, they’re looking at being removed in five days,” said Donnelly.

After hearing similar concerns and others, City Councilwoman Cherelle Parker on Thursday introduced a measure aimed at narrowing and clarifying the new law so that rightful homeowners like Simpkins won’t be prosecuted.

The bill would also bar victims of domestic violence, sexual harassment or stalking from being deemed criminal and defiant trespassers.