If this was in real life, a smuggler, who is already a criminal, operating in a city or town or ****hole as you call it that is filled with illegal dealings and patrolled by a corrupt authoritarian government...legal actions isn't something that really exists. Now, justified as in a moral code...This is Han Solo. The moment he saw Darth Vader, he opened fire on the man knowing his reputation but doesn't believe in it unless he tries it himself.
The rules of the outlaws is very clear here. Jabba had a bounty on Han. Greedo was coming to collect...dead or alive. More money if alive as Jabba requested but as bounty hunters, it's their choice on the method. Obviously the Hutt didn't care either way since Han was eventually delivered to him in frozen Carbonite state so...yeah
Drug smuggler vs. Scummy bounty hunter. It's a hard call but I feel like Han turned out to be a better man than Greedo would have ever been, so I'm gonna go with yes.
Since Tatooine is a fringe world at the edge of the Empire's actual grasp, that it's more of an lawless land. Technically the Empire has authority over it but they treat it more as an occupied country with no local government than a functional civilization.