Brexit: Scrapping Northern Ireland protocol is legal, says attorney general