Every person has a right to defend themselves. Even guilty ones, because until proven, how would you decide they are or they aren't guilty to figure out they have right to defend?
Most people don't know the law enough to adequately defend themselves. Even though you have the option, you would usually be well advised to use help of somebody that knows the law very well because knowing it is their profession and helping you is responsibility.
Just think about this, half of the population has intelligence below mean (ha! not average! but close). You need to generally be highly intelligent to be able to adequately dispute and represent yourself in a court.
So while I loath the fact that criminals use lawyers to escape prison I also recognize that this is their right and that lawyers serve an important function in a society the same way policemen who stop you for speeding or tax auditor looking through your papers do.
Lying to a judge is grounds for disbarment but in general a lawyer has no obligation to verify clients' statements.
It would usually be difficult to prove what the lawyer did or did not know but, hypothetically, if you could prove that the lawyer knew that there was no trespassing then a statement to the court to the contrary can be construed to be a lie and result in consequences.
For example, lawyers in the US routinely file or threaten to file defamation suits in scenarios where the law is clear that no defamation has occurred. I feel that in such situations the most charitable interpretation is that the lawyer is an idiot, and the less charitable interpretation is that the lawyer is a criminal. When a judge considers and ultimately dismisses such a suit, two options present themselves. Either the lawyer is so incompetent as to think that the suit had legitimate grounds, in which case they should lose the ability to file such suits, or the lawyer is maliciously exploiting the legal system for the purpose of harassment, and should similarly lose the ability to file such suits. The fact that judges largely refrain from sanctioning lawyers for even the most severe misconduct results in a world where wealthy individuals are frequently able to use the legal system or the threat of the legal system to harass individuals like journalists into not discussing their activities that are of public interest.
A similar example manifests in patent law, where patent trolls can pursue expensive sham litigation with impunity, to the extent that an entire market exists based on shaking companies down by threatening legal action and offering a settlement for less than the company will have to pay in legal fees to eventually prevail against the sham accusation.
There are judges who are sensitive to it and will go out of their way to punish it. I think part of the problem is that there are many occasions to "fix" the process by getting case resolved in a state that is known to be lenient to certain kind of behavior (very popular with patent trolls).
I don't think there is going to be an easy solution that could be written in law. Rather, the solution is to publicize "bad faith" behavior and lenient treating by judges.
While true, this is to a certain extent the reason why we have judges. We already rely on judges to dismiss lawsuits that are illegitimate, and since filing an illegitimate lawsuit demonstrates either incompetence or malice nothing really needs to be proved about the state of the lawyers mind.
Semi-related but very valuable advice, if well-known - when I was off sick the council brought a complaint against me. They actually lied and implied criminal behaviour (fraud) on my part (also not turning over all the evidence to the tribunal that followed). So here's the important bit:
DO IT IN WRITING AND KEEP COPIES OF EVERYTHING, EVERYTHING YOU WRITE, EVERYTHING THEY SEND YOU. INSIST ON IT BEING ON PAPER (NOT TELEPHONE), AND PRINT EMAILS OUT.
I could rebut almost everything bad they said about me. The tribunal threw out their case before I even turned up.
(I know this is obvious and everyone says get it in writing, but things would be smoother if people actually did).
That's fairly clearly a statement of fact - that in their professional opinion they believe their client has a reasonable chance of prevailing in court.
Do lawyers not have an obligation to display good faith and professional candour in making such statements of fact, even to their adversaries?
The literal words we had written were the facts. Their meaning was up for interpretation. If something as basic as the subject of a conversation cannot be necessarily be agreed upon, something more complicated like "does this infringe on a patent?" certainly has room for disagreement.