Rulings of Manu

As a brahma-bandhu, or a worthless son of a brahmana Asvatthama was not to be killed, but he was at the same time an aggressor also. And according to the rulings of Manu, an aggressor, even though he be a brahmana (and what to speak of an unworthy son of a brahmana), is to be killed. Dronacarya was certainly a brahmana in the true sense of the term, but because he stood in the battlefield he was killed. 

But although Asvatthama was an aggressor, he stood without any fighting weapons. The ruling is that an aggressor, when he is without weapon or chariot, cannot be killed, All these were certainly perplexities. Besides that, Arjuna had to keep the promise he had made before Draupadi just to pacify her. But he also had to satisfy both Bheema and Krsna, who advised killing him. This dilemma was present before Arjuna, and the solution was awarded by Krsna.

Contradictory orders of different persons are impossible to carry out. Therefore a compromise was selected by Arjuna by his sharp intelligence, and he separated the jewel from the head of Asvatthama which was as good as cutting off his head, and yet his life was saved for all practical purposes. SB 1.7.54, 1.7.55