Paris Hilton's boyfriend Cy Waits was just attacked outside the Van Nuys courthouse -- where Paris was set to face the man who allegedly tried to break into her house.
Our guy at the scene says Paris and Cy were walking into the courthouse moments ago when a man "lunged" at Cy ... then grabbed him by the neck.
We're told the couple's security team took down the attacker, who is currently being detained by police.
Paris was scheduled to testify in court today against Nathan Parada ... the alleged knife-wielding man Cy was forced to pull a gun on in August 2010.
Check out the video of the incident above. After the attack, the man -- who we've now identified as James Rainford -- tells photographers he recently proposed to Paris ... and that she accepted. So, yeah.