yes you can. i did that with my M&P sport . Changed to a RRA gas block and mid-lenght freefloat tube. Basic ar tools needed or a buddy with them and some basic knoledge , AR wrench, drift and torgue wrench and 20 minutes.
As stated, if the rail will fit over the gas block and it's a free float, no problem.
"The whole of the Bill (of Rights) is a declaration of the right of the people at large or considered as individuals.... It establishes some rights of the individual as unalienable and which consequently, no majority has a right to deprive them of." (Albert Gallatin of the New York Historical Society, October 7, 1789)
"A free people ought not only to be armed and disciplined, but they should have sufficient arms and ammunition to maintain a status of independence from any who might attempt to abuse them, which would include their own government." - George Washington