“He was panicking and he wasn’t thinking straight,” a barrister has said about a man accused of attempted murder.