* Court to hear league challenge to strike on Wednesday
* Players union, federation unhappy with TV rights law
* Final two La Liga matchdays, Cup final under threat (Adds LFP president quotes in final three paras, details, byline)
By Iain Rogers
MADRID, May 11 (Reuters) - A Spanish court could decide by Wednesday on the legality of a strike protesting against a new TV rights law called by the players' union (AFE) which is threatening the final two La Liga match days and King's Cup final.
The AFE announced last week that players would go on strike indefinitely from May 16 and the professional league (LFP), which represents the 42 clubs in the top two divisions, filed a petition to have the action declared illegal.
The Spanish soccer federation (RFEF) had earlier decided to halt all competition from the same date, a move the LFP is also seeking to block.
The AFE and RFEF are unhappy with a new law mandating collective bargaining for domestic television rights and say their interests have not been sufficiently taken into account.
The AFE and LFP have been summoned to make a court appearance on Wednesday, a league spokeswoman said on Monday, and Spanish media reported a decision could come the same day or on Thursday.
The penultimate round of La Liga matches is on Sunday and leaders Barcelona can make sure of a fifth title in seven years with a win at last season's champions Atletico Madrid.
Barca are also through to the Cup final at the end of the month against Athletic Bilbao.
The new TV rights law, which is strongly backed by the LFP, would replace the current system under which rights are marketed by individual clubs -- unique among Europe's top leagues where collective bargaining is used.
The legislation was signed off in cabinet at the end of last month and aims to create a more level playing field by sharing out cash more equitably once it takes effect from the 2016-17 season.
Poorer teams, especially those with big outstanding tax bills, have for years called for rights to be pooled to help them make ends meet.
The status quo heavily favours Real Madrid, the world's wealthiest club by income, and their arch-rivals Barca.
Although the new set-up would still be weighted towards the richest and most successful clubs it would be to a lesser extent.
The AFE supports the idea of collective bargaining but is unhappy, among other things, with the share of the cash pot set aside for second-division clubs.
The RFEF believes the law will rob it of some powers and is opposed to what it says are plans to use money from football to fund other sports.
LFP president Javier Tebas said after an emergency general assembly on Monday he was not optimistic the two sides' positions could be reconciled.
"I think it will be difficult to reach an agreement because they are asking for the law to be modified," Tebas told reporters.
The league were ready to sit down with the federation and the union to seek an accord, he added. (Editing by Ed Osmond and Ken Ferris)