God’s child:
Hypothetically … I don’t want to use names:
A priest is found by the Catholic Church to have disobeyed the Laws of the Church and the Land – so the Church “retires” him (this was done years ago) and strips him of all priestly rights.
Can he then do the Sacraments? And if he does, are marriages legal?
There are differences between “can” and “should” (or “ought”.) These differences usually boil down, in Church and State terms, as “licit” (meaning “legal”) and “valid” (meaning effecting what is sought to be done).
Looking as the “State” situation:
Q. “can” a person (in the USA) drive normally on the left-hand side of the road?
A. Well, yes, he “can” - that is he cannot be physically forced (apart from on-coming traffic) from driving on the left-hand side.
But, he “ought” not (legally and for safety and for moral reasons.0
Looking at the Church question:
Q. “can” a person (who is validly ordained, uses the correct “matter” and “form” for a sacrament and who has the “Intention” required by the Church) - can such a person say, for example, Mass?
A. Yes, he “can” that is, he is capable of doing so “validly” - but, unless he does so with the faculties of his local bishop - then he does so “illicitly” that is, illegally. And, as with the State, he incurs a penalty.
You mention that has been stripped of all priestly rights - this usually means “suspended a divinis” and means that he is morally unable to perform ANY priestly functions - except for a person who is in danger of death.
Any-one who knows of his status and who avails themselves of his services is also knowingly going contrary to the mind of the Church and is committing a grave (mortal) sin. It would appear also that they are performing an schismatic act - for which the penalty is excommunication.
So! “can” such a person do what you describe? Yes, he “can” - but he should not - just as certainly as a satanist “can” say a Black Mass - but “should” not!
Specifically, as to Marriage: He does not have the faculties from his bishop to perform a marriage. If he does so, the marriage is neither licit nor valid. That means the couple remain in exactly the same state as they were prior to the marriage. The other consideration is as to whether he had the authority from the State to perform marriages “for the State.”
I hope that this helps?