Samajwadi Party chief Akhilesh Yadav has been detained by the police from outside his residence in Uttar Pradesh capital Lucknow where he staged a sit-in after being stopped from visiting Lakhimpur Kheri district, where eight including four farmers were killed in violence on Sunday.