does anyone know how to get into the city of Markarth without the guards attacking you?

I did a quest that got me sent to gaol and i escaped and now all they do is say i will go to gaol but dont take me there so I have to resist arrest.

please answer :)