Key cabinet appointment is legal, says Mark Drakeford
First Minister Mark Drakeford has insisted he followed devolution law in appointing his new Welsh Government after legal concerns were raised.
Mr Drakeford announced before Christmas that Neath AM Jeremy Miles would be Brexit minister and counsel general, the government's chief legal adviser.
The Government of Wales Act 2006 states counsel generals cannot hold ministerial office.
The government said Mr Miles would not be "exercising any statutory powers".
A spokesperson said he would represent the administration in other ways.
Mr Miles's appointment was approved by the assembly on Tuesday evening, with 31 AMs voting in favour, 14 abstentions and six against.
The counsel general's responsibilities include exercising independent legal functions in the public interest and has to be appointed by the Welsh Assembly as a whole.
Mr Miles was counsel general under Mr Drakeford's predecessor Carwyn Jones.
Described as Brexit minister and counsel general designate on the Welsh Government website, Mr Miles's list of responsibilities includes the Joint Ministerial Council, in which UK and devolved ministers meet.
Plaid Cymru AM Rhun ap Iorwerth said there was a "clear conflict of responsibilities", accusing Welsh ministers of bending the rules.
"Given that Brexit is such a major issue for the government much of the counsel general's work would involve giving legal advice to himself, which is hardly an acceptable situation," he said.
"The counsel general also has to act independently of government at times. How can someone who's also a minister act independently of government?"
Conservative AM and former deputy presiding officer David Melding called the appointment "highly irregular".
"It cannot have been the intention of the drafters of the law to allow this level of flexibility," he said.
"We should observe the rules and not interpret them out of existence when they're not convenient."
But Mr Drakeford assured assembly members the appointment of Mr Miles as counsel general and Brexit minister was "entirely consistent with the Government of Wales Act".
A Welsh Government spokesperson added: "The counsel general and Brexit minister is not appointed under section 48 of the Government of Wales Act 2006, and as such will not be exercising any statutory powers conferred on the Welsh ministers when carrying out his ministerial responsibilities.
"He will however still be able to represent Welsh Government in negotiations, provide advice on strategy, as well as coordinate a coherent and consistent approach to the Welsh Government's response to Brexit."
By BBC Wales political editor Felicity Evans
When is a minister not a minister? When they're also counsel general apparently.
Jeremy Miles is described as Brexit Minister on the Welsh Government website, his responsibilities are listed and they include things like the Shared Prosperity Fund - the planned replacement for EU aid money which you'd imagine could require some significant decision making in due course.
But Mr Miles, widely regarded as an intelligent and able person, will not be making any decisions on Brexit because the Welsh Government says he doesn't have any statutory power.
We're told he will represent, advise and coordinate on Brexit - more of an ambassador than a minister perhaps?
An odd situation for your point man on the issue that the first minister described as recently as Monday as "the biggest question facing us in a generation".