“Ted 2” (Universal) is another wallow in sexist, racist, stoner vulgarity by Seth MacFarlane.

MacFarlane directed, co-wrote the screenplay with Alec Sulkin and Wellesley Wild and voices the potty-mouthed teddy bear who ventures into crude sexual gags and casually expressed racism along with his trademark pop-culture riffs.

The core story to this sequel to the 2013 film is solid enough, dealing with Ted’s quest for legal personhood. At the end of the first film, Ted was best man at the wedding of his childhood owner, Boston native John (Mark Walhlberg). This installment begins with John sadly divorced for six months while Ted is getting married to grocery cashier Tami-Lynn (Jessica Barth). It’s a rocky coupling, which they decide to “save” by having a child.

After some lewd adventures attempting to find a sperm donor and learning that Tami-Lynn is infertile, they pursue adoption. The unexpected consequence: The state of Massachusetts decides that the 2-foot-tall Ted is “property,” not a person, and as a result, his marriage is annulled and he loses his grocery store job. This sets John and Ted on a quest for courtroom justice.

Is Ted capable of love? Is he aware of his own consciousness? Does he have empathy? Has he a soul? Well, obviously, but the first trial with his pot-smoking rookie lawyer Sam (Amanda Seyfried) ends in failure.

While this is going on, Ted’s stalker, Donny (Giovanni Ribisi), now working as a janitor at Hasbro, concocts another plot to kidnap the bear and cut him open, so the toy giant, after seeing whether Ted is merely stuffed with fluff or has some magical inside construction, can manufacture many more.

Before the courtroom finale — in which lawyer Patrick (Morgan Freeman) makes their eloquent argument by invoking Dred Scott — John, Sam and Ted go on a raucous road trip to New York City to recruit the barrister. This creates the film’s crudest sexual reference involving a bong.

The film contains casual racist remarks including the N-word, references to aberrant sexual behavior, fleeting female nudity, pervasive drug use and pervasive crude, crass and profane language. (O, R).