Of all the things that you might imagine Parliament to do, legalising crime is unlikely to be one of them.
But that is exactly what is likely to happen - albeit in rather specific circumstances - under one of the least understood, but most important bills before MPs today.
The Covert Human Intelligence Sources (Criminal Conduct) Bill is a long and technical name for something quite simple.
But the very nature of the proposal exposes one of the most difficult tensions for a modern democracy: How far do you trust the state to do things in the shadows to protect each and everyone of us, without ever knowing what those things are.
What does the bill do?
The legislation creates a licence - or strictly speaking an "authorisation" - for undercover agents and informants to commit crimes as part of their work.
An agent is not a James Bond-style officer running around on Her Majesty's Secret Service. An agent is someone in the community who's recruited to help the police, security agencies and other investigators to uncover and disrupt crime and serious threats to the nation.
These covert human intelligence sources - "CHIS" to use the jargon - are absolutely vital to operations.
Every foiled terrorism plot in recent years has involved some kind of CHIS - such as this extraordinary plan to bomb Downing Street.
Major operations targeted the worst of organised crime - such as drugs and arms running, people trafficking and appalling child sexual abuse rings, are targeted by CHIS teams.
And it doesn't stop there.
The Environment Agency sometimes runs undercover jobs into toxic waste dumping, while the UK's medicines watchdog is constantly on the hunt for black market gangs trading counterfeit drugs.
So any agency placing an agent into an investigation will have to find someone who can convince the target that they are part of the gang.
Quite often, the CHIS will be a former criminal themselves - or someone involved in offences related to the main target's activity, who can credibly pass themselves off as someone to be trusted.
An example (not based on any specific case, I stress) would be an operation to target gun running into the UK.
Investigators may conclude that they need to recruit a known cigarette smuggler to help gather intelligence, because that individual would have the right experience and criminal credibility to fit into a highly dangerous gang.
And that would mean they would inevitably have to be involved in crime again at some kind of level. You probably can't put someone in a drugs network without them being prepared to help shift the merchandise. You're unlikely to convince a terror cell that you're one of them if you won't help them to raise cash.
So why, if this kind of undercover criminality has been going on forever, is Parliament now being asked to legislate?
Until now, there has been very little in the public domain about the rules that were devised in house by MI5, the police and others down the years. But there is some urgency thanks to a complex case before the courts.
If the CHIS Bill doesn't pass into law, there is a significant risk that this legal challenge to the existing rules - or rather the lack of clarity around them - could go against the government in the Court of Appeal and - worse still - at the Supreme Court.
That would result in agents left, right and centre, being withdrawn from operations that may be saving lives.
And so the government is rushing the legislation through Parliament before that happens.
How would the new rules work?
There are existing laws to allow security agencies and the police to recruit and authorise an agent to go undercover.
That system will be extended to allow them to commit a specific crime as part of that job.
If that authorisation is correctly followed, then the agent and the officers overseeing the operation can't be prosecuted.
At the end of each year, the watchdog overseeing covert powers will report on their use.
What crimes can be committed? Well, the legislation doesn't tell us.
It simply says that an authorisation must "take into account" the requirements of the Human Rights Act.
Which agencies will be able to authorise their undercover agents to commit crimes?
- MI5 and other intelligence bodies
- Police forces and the National Crime Agency
- Immigration and Border Officers
- HM Revenue and Customs, Serious Fraud Office
- UK military forces
- Ministry of Justice (investigations in prisons)
- Competition and Markets Authority, Environment Agency, Financial Conduct Authority, Food Standards Agency, Gambling Commission and Medicines and Healthcare Regulation Authority
What does that mean in practice?
The Human Rights Act provides some minimum guarantees as to how people should be treated by the state. It says that everyone has a right to life, a right not to be tortured or subjected to inhuman or degrading treatment or unlawfully detained.
On one reading, that implies that agencies would not authorise someone to commit an act of violence - but critics say it is not clear enough.
The equivalent law in Canada bans an agent from getting involved in killing, sexual violence and other serious crimes.
Labour's front bench position is to support the bill - when Sir Keir Starmer was the Director of Public Prosecutions he would have been aware of such sensitive operations - but to also demand Canadian-style guarantees.
That has not pleased everyone in the party - there have been attempts from the Labour left and those closest to the unions to push the leadership to go further.
Dan Carden, the shadow Treasury financial secretary, has now resigned saying he will vote against the Bill because of the precedent it sets for the rule of law.
Other attempted amendments include an attempt to ban recruiting children - something that has emerged in relation to "county lines" drugs gangs.
The guessing game
The problem from the state's perspective is that these kinds of explicit prohibitions risk giving the game away.
The more information that the bad guys have about how infiltrators will operate, the easier it will be to test them and smoke them out. And in the case of terrorism and serious organised crime, the agent may end up dead.
This is the sole reason why agencies in the UK, neither confirm nor deny what goes on in the shadows: they want to keep the targets guessing. The less they know, the better the chances of running successful operations.
Oversight and redress
But the less the law-abiding public know, the harder it is to see whether such laws are being correctly applied - or potentially abused.
And the most extreme examples of abuse involving undercover assets come from Northern Ireland.
In 1989, Belfast lawyer Pat Finucane was shot dead at his family dining table by a Loyalist gunman. His family are fighting for a full public inquiry because the gunman, and the man who gave him the intelligence, were agents of the state.
The family's position today is that the CHIS bill would help cover up such horrendous crimes.
Another major area of concern is infiltration of abuse rings. In one recent case on Tyneside, it emerged that the police paid a convicted paedophile to help break open a network. The police stood by their operational decision - but the public were shocked.
And finally, there is the ongoing saga of one of the UK's longest unresolved public inquiries into abuses by undercover police officers.
That inquiry will ultimately examine how some officers got away - for years - with systematically tricking women into sexual relationships that police chiefs now admit amounted to serious abuse.
These are some of the reasons why the CHIS bill is so controversial for people who say they have been on the receiving end of shocking treatment, supposedly in the interests of preventing a greater harm.
But at the same time, there is can be little dispute that there needs to be some kind of system to allow agents to go deep into organisations that would do us harm.
That is the tension - and there is going to be something of a battle over its final shape, both in the Commons and later in the Lords.