So the genie made the town up. Therefore he made the civvies and their morals. But he still made a jail. Therefore the genie made some of the civvies intentionally bad just so that he could punish them.
That is some hardcore evil on the genies part right there (not counting outsiders of course who can be jailed).
The thief and the girl were probably running out of the palace together after he took the lamp. When the guards started chasing them, they split up. The girl outran her pursuers, but Jeff stopped the thief. Soon after, Jeff was thrown in the dungeon. Later, they caught the girl, which leaves us at the present.
That's my guess, anyhow.