Legal action to prevent grammar schools expanding by the back door in England is being threatened by a teachers' union.
The National Union of Teachers says some academy trusts are advertising for pupils to join "grammar streams" within comprehensives using an ability test.
The NUT has written to Education Secretary Justine Greening threatening a judicial review.
The Department for Education says streaming by ability is allowed.
However, the teachers' union says it has identified practices which go much further than putting pupils in ability streams.
This involves a group of children who win a place in a grammar stream by way of a test, who then go on to be educated separately from their peers.
Multi-academy trusts are already able to stream by ability across their groups of schools and teach pupils at a separate site, says an education department spokeswoman.
And the education department says it is ready to investigate any breaches of the admissions code at these so far unidentified schools.
The union highlights that any expansion of selection by ability remains unlawful, as laid down in the legislation introduced in 1998 which blocked the opening of new grammar schools.
Ms Greening has set out plans for a new generation of grammar schools, which would require legislation to overturn the ban on increasing selection.
But the Green Paper on grammars also raised the idea of academy trusts establishing a single centre for their most able pupils.
According to the NUT, a handful of academy trusts are already running grammar streams within schools which are otherwise comprehensive.
It argues this is an expansion of grammar school places by the back door.
It has sent solicitors' letters to the schools in question asking them to explain the practice.
Kevin Courtney, NUT general secretary, refused to name the schools, but said he was talking about something way beyond setting and streaming by ability, where children can go up and down between classes.
"There are schools that are advertising publicly that they are running a 'grammar stream' and running entry tests for it."
This, the NUT argues, is in breach of the admissions code.
"We are aware that the government is trying other routes other than primary legislation to increase the number grammar schools," said Mr Courtney.
"They're examining the possibility that one of your schools could be selective within a multi-academy trust, and saying this is just like streaming."
He added that the government had no manifesto mandate for grammar schools and that it was likely that any legislation would have a difficult passage through Parliament.
And he suggested ministers may be seeking a non-Parliamentary route for the expansion.
"We think that's illegal and we are investigating ways of challenging that."
Legal action could take the form of a judicial review of a school's decision to adopt and recruit for such a selective stream.
Or it may be a judicial review of any forthcoming guidance from the secretary of state to academy trusts allowing them to open separate grammar schools or streams within their group of schools.
The union later resolved to resist, in the strongest possible terms, any attempts to expand selective education and to investigate legal routes by which it may be opposed.
Mr Courtney's letter to the education secretary says: "The existence of a separate establishment within the trust, for which pupils would be selected following admission to a school within the trust, would create a situation in which schools were seeking to frustrate the purpose of the law, which clearly sets out to prevent such selection."
The Department for Education says that multi-academy trusts can already stream by ability across their schools, with these ability groups being taught at different sites - and the consultation on grammars will not affect this.
A department spokeswoman said: "Streaming pupils by ability is, and has always been, allowed at all schools, and helps teachers give every child an appropriately stretching education.
"Multi-academy trusts have always been able to pool their resources to deliver these benefits on a larger scale and across different sites within the trust, and we want to see more do this."