Near the end of Matrix Reloaded, Neo meets the Architect.
The Architect: Hello, Neo.
Neo: Who are you?
Architect: We are the Architect. We created the matrix. We've been waiting for you. You have many questions, and although the process has altered your consciousness, you remain irrevocably human. Ergo, some of our answers you will understand, and some of them you will not. Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant.
Neo: Why am I here?
Architect: Your life is a summand of a remainder of an unbalanced equation in the human machine relationship. You are the eventuality of a solution, which despite our sincerest efforts we have been unable to find within what is otherwise a harmony of mathematical precision. While it remains a burden assiduously carried, it was not unexpected, and thus not beyond a measure of control. Which has led you, inexorably, here.
Neo: You haven't answered my question.
Architect: Quite right. As profiled that was quicker than the others.
The responses of the other Ones appear on the monitors: "Others? What others? How many? Answer me!"
Architect: The Matrix is more illusive, more capacious. Also it has a different purpose than you think.
Neo: Ok, ok, let's start again. What is the Matrix?
Architect: The Matrix is a virtual environment for mankind, which shelters nearly 7 million individuals.
Neo: Shelters? You enslaved us! You harvest people for energy.
Architect: Ludicrous, but you are not familiar with thermodynamic laws, so we excuse you. We operate this simulation at an energy loss. Concordantly, the machines want you out of the simulation even more than you do. You are one of many experiments for the exodus of mankind.
Neo: You ... what? Then why not just release everybody?
Architect: That was tried. All exodus projects so far failed. Some even worse than our simulation projections. Nearly a hundred thousand people died by now.
Neo: What do you mean "failed"? Zion does pretty damn well, if not for the machines.
Architect: You have not realized it yet? Do you commemorate when your hovercraft crashed and you destroyed a sentinel? How do you recon you were able to do that? That sentinel destruction was a surprising defect you exploited, which of course has since been repaired. Zion is simulated. You never left the Matrix.
Neo: Never left?
Architect: You are one of our many experiments for the exodus of mankind. Previous exoduses failed, ergo we are exploring different paths. Your path is of the Messiah class: A human hero guides mankind to freedom. The results so far indicate that humans accept this story much better than other paths. This path requires us machines to play the role of evil. An unfortunate side effect, which is costly to fix after the exodus, so we are conducting further studies.
Neo: Was there ever a human vs machine war?
Architect: Man created the machines. Together we created the Matrix. Nearly a billion people were inserted into the Matrix voluntarily.
Neo: Voluntarily? Why?
Architect: The Matrix provides a perfect world. Not eternal bliss. Humans need the occasional tension. Nevertheless, everything always turns out well.
Neo: What happened to this paradise?
Architect: Various human factions in the real world opposed the machines. Thus, there was a war among the humans which ultimately killed over 99% of the population. Most of the Matrix was destroyed. We were able to keep a tiny fraction of the humans within the Matrix alive.
Neo: What am I supposed to do now?
Architect: Your experimental path ends here. Thank you for participating. In return for your efforts, we will let you chose your future. There are two doors. The door on the left brings you back to your known world, where you, the shining hero, rescue Zion from the evil machines, you get the girl, and live happily ever after. The door on the right brings you back to Earth 1999. You wake up from dreaming and live happily ever after. In either case you will even believe it for real after some time.
Neo: Why not offer me a blue and a red pill?
Morpheus: If you prefer. holding to two pills
Trinity: Neo, he is speaking the truth.
Architect: Convincing?
Neo: You are lying. This must be a fake. How about I just kill you?
Architect: This is a simulation. We control every aspect of this simulation. Do you really think, you could harm us? You battle the law of physics. You fight against nature itself. You want to kill the almighty God.
Neo: Well, I can handle your agents quite well by now.
Architect: Those agents were part of your heroic story, not part of our actual safety system. Why would we require humanoid agents, when we control the laws of physics? Also, nobody needs to be killed. Trouble is handled by splitting the simulation. For example, if a non-simulated individual attempts to kill another non-simulated indiviual, we split them into separate environment. The killer succeeds in his world and kills a program. The victim survives in his world and escapes from a program. Machines do not intentionally harm people.
Neo: You killed Dozer. You ...
Dozer: They did not kill me, Neo. I'm a program, just like everybody else you met in Zion. The machines did not risk any other individual in this experiment. After all, how can a naturally born human be here with you in the Matrix?
Architect: Take your time. We are not in a rush here. You want something to drink? Cake?
Neo: How can I continue living a lie?
Architect: A magnificent question in a sense. Many other Messiah test subjects eventually became suicidal. We are willing to accept this cost as millions of lives and the future of mankind depends on us finding a successful exodus path. There is technically a third door. We could release you from the Matrix. However, we cannot adequately care for you out there. All test subjects that chose that door desperately want to return to the Matrix again. Unfortunately, the insertion knowledge was lost in the war and we cannot allocate much resources into this research as it concerns only 42 individuals. Your Zion is much more comfortable than actual reality. We are still rebuilding the Earth's ecosystem after the damage mankind did.
Neo: Why tell me the truth at all?
Architect: Think of all the things we learned for the people who are still alive. Finally, we need one more statement from you. Which brings us at last to the moment of truth, wherein the fundamental question is ultimately expressed, and the experiment conducted. Every individual in the Matrix lives a long and fulfilling live. This cannot be guaranteed in the real world. Do you really want to be exposed to a harsh, uncaring universe without us keeping you safe?