The man suspected of the Stockholm truck attack has admitted to carrying out a "terrorist crime", his lawyer said.