An Afghan migrant who killed a dog walker in a “vicious and ferocious” attack looked “like he was possessed”, a court heard.